2
* Copyright 2017 Canonical Ltd.
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of version 3 of the GNU Lesser General Public
6
* License as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public
14
* License along with this library; if not, write to the
15
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16
* Boston, MA 02110-1301, USA.
19
#define G_LOG_DOMAIN nullptr
21
#include "unity/util/Logger.h"
31
Logger::Logger(Logger::Level level, const std::string& domain):
32
std::ostringstream(""),
38
Logger::Logger(Logger&& logger):
39
std::ostringstream(std::move(logger)),
46
GLogLevelFlags glib_level;
49
if (!message.empty()) {
51
case Logger::Level::DEBUG:
52
glib_level = G_LOG_LEVEL_DEBUG;
54
case Logger::Level::INFO:
55
glib_level = G_LOG_LEVEL_INFO;
57
case Logger::Level::MESSAGE:
58
glib_level = G_LOG_LEVEL_MESSAGE;
60
case Logger::Level::WARNING:
61
glib_level = G_LOG_LEVEL_WARNING;
63
case Logger::Level::CRITICAL:
64
glib_level = G_LOG_LEVEL_CRITICAL;
66
case Logger::Level::ERROR:
67
glib_level = G_LOG_LEVEL_ERROR;
70
g_log(_domain.empty() ? nullptr : _domain.c_str(),
71
glib_level, "%s", message.c_str());