embkernel
 All Classes Functions Variables Typedefs Groups Pages
LibLog.hpp
1 //------------------------------------------------------------------------------
2 //This file is part of embKernel.
3 //See license.txt for the full license governing this code.
4 //------------------------------------------------------------------------------
5 
6 #ifndef LIB_LOG_HPP_
7 #define LIB_LOG_HPP_
8 
9 #include "LibStreamOut.hpp"
10 #include "RtosSemaphore.hpp"
11 
12 class LibLog {
13 public:
14  typedef enum {
15  LEVEL_VERBOSE = 0,
16  LEVEL_INFO = 1,
17  LEVEL_WARNING = 2,
18  LEVEL_ERROR = 3,
19  LEVEL_OFF,
20  } LEVEL;
21 
22  static LEVEL sLevel;
23  static LibStreamOut* sStream;
24  static RtosSemaphore sSema;
25 
26  static int printf(LEVEL level, const char* string, ...) __attribute__ ((format (printf, 2, 3)));
27  static void setStream(LibStreamOut* stream);
28  static void setLevel(LEVEL level);
29 
30 private:
31  static void flush();
32 
33 };
34 
35 extern LibLog log;
36 
37 #endif /* LIB_LOG_HPP_ */