forked from pocoproject/poco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAndroidLogChannel.cpp
65 lines (51 loc) · 1.1 KB
/
AndroidLogChannel.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// 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