Fledge
An open source edge computing platform for industrial users
logger.h
1 #ifndef _LOGGER_H
2 #define _LOGGER_H
3 /*
4  * Fledge storage service.
5  *
6  * Copyright (c) 2017-2018 OSisoft, LLC
7  *
8  * Released under the Apache 2.0 Licence
9  *
10  * Author: Mark Riddoch, Massimiliano Pinto
11  */
12 
13 #include <string>
14 
15 #define PRINT_FUNC Logger::getLogger()->info("%s:%d", __FUNCTION__, __LINE__);
16 
26 class Logger {
27  public:
28  Logger(const std::string& application);
29  ~Logger();
30  static Logger *getLogger();
31  void debug(const std::string& msg, ...);
32  void printLongString(const std::string&);
33  void info(const std::string& msg, ...);
34  void warn(const std::string& msg, ...);
35  void error(const std::string& msg, ...);
36  void fatal(const std::string& msg, ...);
37  void setMinLevel(const std::string& level);
38  std::string& getMinLevel() { return levelString; }
39  private:
40  std::string *format(const std::string& msg, va_list ap);
41  static Logger *instance;
42  std::string levelString;
43  int m_level;
44 };
45 
46 #endif
Fledge Logger class used to log to syslog.
Definition: logger.h:26
void setMinLevel(const std::string &level)
Set the minimum logging level to report for this process.
Definition: logger.cpp:73