poco/Foundation/src/AndroidLogChannel.cpp
Rangel Reale 1c648764c2 - Android log channel implementation
- Removes warning from Bugcheck.h on Android

fixes #122
2015-01-29 11:14:39 -02:00

66 lines
1.1 KiB
C++

//
// AndroidLogChannel.cpp
//
// $Id: //poco/1.4/Foundation/src/AndroidLogChannel.cpp#2 $
//
// Library: Foundation
// Package: Logging
// Module: AndroidLogChannel
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "Poco/AndroidLogChannel.h"
#include "Poco/Message.h"
#include <android/log.h>
namespace Poco {
AndroidLogChannel::AndroidLogChannel(const std::string &tag) :
_tag(tag)
{
}
AndroidLogChannel::~AndroidLogChannel()
{
}
void AndroidLogChannel::log(const Message& msg)
{
int prio = ANDROID_LOG_DEBUG;
switch (msg.getPriority())
{
case Message::PRIO_FATAL:
prio = ANDROID_LOG_FATAL;
break;
case Message::PRIO_CRITICAL:
case Message::PRIO_ERROR:
prio = ANDROID_LOG_ERROR;
break;
case Message::PRIO_WARNING:
prio = ANDROID_LOG_WARN;
break;
case Message::PRIO_NOTICE:
case Message::PRIO_INFORMATION:
prio = ANDROID_LOG_INFO;
break;
case Message::PRIO_TRACE:
prio = ANDROID_LOG_VERBOSE;
break;
}
__android_log_print(prio, _tag.c_str(), msg.getText().c_str());
}
} // namespace Poco