2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file dlog_log_provider.cpp
18 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
20 * @brief This file is the implementation file of DLOG log provider
23 #include <dpl/log/dlog_log_provider.h>
28 #define UNUSED __attribute__((unused))
30 namespace SecurityManager {
32 std::string DLOGLogProvider::FormatMessage(const char *message,
37 std::ostringstream val;
39 val << std::string("[") <<
40 LocateSourceFileName(filename) << std::string(":") << line <<
41 std::string("] ") << function << std::string("(): ") << message;
46 DLOGLogProvider::DLOGLogProvider()
49 DLOGLogProvider::~DLOGLogProvider()
52 void DLOGLogProvider::SetTag(const char *tag)
54 size_t size = strlen(tag)+1;
55 char *buff = new (std::nothrow) char[size];
57 memcpy(buff, tag, size);
61 void DLOGLogProvider::Debug(const char *message,
66 SLOG(LOG_DEBUG, m_tag.get(), "%s",
67 FormatMessage(message, filename, line, function).c_str());
70 void DLOGLogProvider::Info(const char *message,
75 SLOG(LOG_INFO, m_tag.get(), "%s",
76 FormatMessage(message, filename, line, function).c_str());
79 void DLOGLogProvider::Warning(const char *message,
84 SLOG(LOG_WARN, m_tag.get(), "%s",
85 FormatMessage(message, filename, line, function).c_str());
88 void DLOGLogProvider::Error(const char *message,
93 SLOG(LOG_ERROR, m_tag.get(), "%s",
94 FormatMessage(message, filename, line, function).c_str());
97 void DLOGLogProvider::Pedantic(const char *message,
100 const char *function)
102 SLOG(LOG_DEBUG, "SecurityManager", "%s", FormatMessage(message,
109 } // namespace SecurityManager