Embedded Multicore Building Blocks V1.0.0
log.h
1 /*
2  * Copyright (c) 2014-2017, Siemens AG. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24  * POSSIBILITY OF SUCH DAMAGE.
25  */
26 
27 #ifndef EMBB_BASE_LOG_H_
28 #define EMBB_BASE_LOG_H_
29 
30 #include <embb/base/c/log.h>
31 
38 namespace embb {
39 namespace base {
40 
46 class Log {
47  private:
48  // do not allow construction
49  Log();
50 
51  public:
58  static void SetLogLevel(
59  embb_log_level_t log_level
61  );
62 
73  static void SetLogFunction(
74  void * context,
78  );
79 
87  static void Write(
88  char const * channel,
92  embb_log_level_t log_level,
93  char const * message,
95  ...
98  );
99 
106  static void Trace(
107  char const * channel,
108  char const * message,
110  ...
113  );
114 
121  static void Info(
122  char const * channel,
123  char const * message,
125  ...
128  );
129 
135  static void Warning(
136  char const * channel,
137  char const * message,
139  ...
142  );
143 
149  static void Error(
150  char const * channel,
151  char const * message,
153  ...
156  );
157 };
158 
159 } // namespace base
160 } // namespace embb
161 
162 #endif // EMBB_BASE_LOG_H_
Definition: lock_free_mpmc_queue.h:40
static void Warning(char const *channel, char const *message,...)
Logs a message to the given channel with EMBB_LOG_LEVEL_WARNING.
void(* embb_log_function_t)(void *context, char const *message)
Logging function type.
Definition: log.h:65
Simple logging facilities.
Definition: log.h:46
static void Error(char const *channel, char const *message,...)
Logs a message to the given channel with EMBB_LOG_LEVEL_ERROR.
static void SetLogLevel(embb_log_level_t log_level)
Sets the global log level.
static void Trace(char const *channel, char const *message,...)
Logs a message to the given channel with EMBB_LOG_LEVEL_TRACE.
static void Write(char const *channel, embb_log_level_t log_level, char const *message,...)
Logs a message to the given channel with the specified log level.
static void SetLogFunction(void *context, embb_log_function_t func)
Sets the global logging function.
static void Info(char const *channel, char const *message,...)
Logs a message to the given channel with EMBB_LOG_LEVEL_INFO.
embb_log_level_t
Log levels available for filtering the log.
Definition: log.h:47