You.i Engine
YiLogger.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2017. All rights reserved.
2 #ifndef _YI_LOGGER_H_
3 #define _YI_LOGGER_H_
4 
5 #include "logging/YiLogPolicy.h"
6 #include "utility/YiString.h"
7 
8 #include <memory>
9 
29 class CYILogger
30 {
31  friend class CYILoggerPriv;
32 
33 public:
37  CYILogger();
38 
42  CYILogger(const char *pModuleName,
43  const char *pPrettyFunction,
44  uint32_t unLineNumber,
45  const CYIString &rTagName,
46  YI_LOG_SEVERITY eSeverity,
47  const char *pLogMessage,
48  ...);
49 
53  CYILogger(const char *pModuleName,
54  const char *pPrettyFunction,
55  uint32_t unLineNumber,
56  const CYIString &rTagName,
57  YI_LOG_SEVERITY eSeverity,
58  const char *pLogMessage,
59  va_list varArgPtr);
60 
64  CYILogger(const char *pModuleName,
65  const char *pPrettyFunction,
66  uint32_t unLineNumber,
67  const std::string &rTagName,
68  YI_LOG_SEVERITY eSeverity,
69  const char *pLogMessage,
70  va_list varArgPtr);
71 
77  CYILogger(const char *pModuleName,
78  const char *pPrettyFunction,
79  uint32_t unLineNumber,
80  const char *pTagName,
81  YI_LOG_SEVERITY eSeverity,
82  const char *pLogMessage,
83  va_list varArgPtr);
84 
88  ~CYILogger();
89 
90  static std::shared_ptr<CYILogPolicy> CreateDefaultLogPolicy();
91 
97  static void SetLogPolicy(const std::shared_ptr<CYILogPolicy> &pPolicy);
98 
102  static const std::shared_ptr<CYILogPolicy> &GetLogPolicy();
103 
107  static const std::shared_ptr<CYIPreferences> &GetPreferences();
108 
116  static void SetPreferences(const std::shared_ptr<CYIPreferences> &pPrefs);
117 
123  static void SetLoggingEnabled(bool bEnabled);
124 
125 private:
126  void Init(const char *pModuleName,
127  const char *pPrettyFunction,
128  uint32_t unLineNumber,
129  const char *pTagName,
130  bool bTagNameIsStatic,
131  const char *pLogMessage,
132  YI_LOG_SEVERITY eSeverity,
133  va_list varArgPtr);
134 
135  static bool s_bLoggingEnabled;
136  static std::shared_ptr<CYILogPolicy> s_pLogPolicy;
137 };
138 
141 #endif // _YI_LOGGER_H_
static void SetLogPolicy(const std::shared_ptr< CYILogPolicy > &pPolicy)
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:35
The logging class reports messages to the programmer via a policy.
Definition: YiLogger.h:29
static const std::shared_ptr< CYIPreferences > & GetPreferences()
static void SetLoggingEnabled(bool bEnabled)
YI_LOG_SEVERITY
Enumeration for the severity levels.
Definition: YiLoggerCommon.h:51
static void SetPreferences(const std::shared_ptr< CYIPreferences > &pPrefs)
static std::shared_ptr< CYILogPolicy > CreateDefaultLogPolicy()
static const std::shared_ptr< CYILogPolicy > & GetLogPolicy()
friend class CYILoggerPriv
Definition: YiLogger.h:31