iceoryx_doc
1.0.1
iceoryx_utils
log
logger.hpp
1
// Copyright (c) 2019 by Robert Bosch GmbH. All rights reserved.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
//
15
// SPDX-License-Identifier: Apache-2.0
16
#ifndef IOX_UTILS_LOG_LOGGER_HPP
17
#define IOX_UTILS_LOG_LOGGER_HPP
18
19
#include "iceoryx_utils/log/logcommon.hpp"
20
#include "iceoryx_utils/log/logstream.hpp"
21
22
#include <atomic>
23
#include <chrono>
24
#include <functional>
25
#include <string>
26
27
namespace
iox
28
{
29
namespace
log
30
{
33
34
class
Logger
35
{
36
friend
class
LogManager
;
38
friend
class
LogStream
;
39
40
public
:
41
Logger
(
Logger
&& other);
42
Logger
& operator=(
Logger
&& rhs);
43
44
Logger
(
const
Logger
& other) =
delete
;
45
Logger
& operator=(
const
Logger
& rhs) =
delete
;
46
47
void
SetLogLevel(
const
LogLevel logLevel) noexcept;
48
void
SetLogMode(
const
LogMode logMode) noexcept;
49
bool
IsEnabled(
const
LogLevel logLevel)
const
noexcept;
50
51
LogStream
LogFatal() noexcept;
52
LogStream
LogError() noexcept;
53
LogStream
LogWarn() noexcept;
54
LogStream
LogInfo() noexcept;
55
LogStream
LogDebug() noexcept;
56
LogStream
LogVerbose() noexcept;
57
58
protected:
59
Logger
(std::
string
ctxId, std::
string
ctxDescription, LogLevel appLogLevel);
60
61
// virtual because of Logger_Mock
62
virtual
void
Log(const
LogEntry
& entry) const;
63
64
private:
65
void
Print(const
LogEntry
entry) const;
66
67
std::atomic<LogLevel> m_logLevel{LogLevel::kVerbose};
68
std::atomic<LogMode> m_logMode{LogMode::kConsole};
69
};
70
71
}
// namespace log
72
}
// namespace iox
73
74
#endif
// IOX_UTILS_LOG_LOGGER_HPP
iox::log::LogManager
Definition:
logmanager.hpp:37
iox::log::LogStream
Definition:
logstream.hpp:114
iox::log::Logger
Definition:
logger.hpp:35
iox
building block to easily create free function for logging in a library context
Definition:
lockfree_queue.hpp:28
iox::log::LogEntry
Definition:
logcommon.hpp:70
Generated by
1.9.1