Lumiverse  2.5
A framework for creating lighting control applications
Logger.h
Go to the documentation of this file.
1 
4 #ifndef _LOGGER_H_
5 #define _LOGGER_H_
6 
7 #pragma once
8 
9 #include <fstream>
10 #include <sstream>
11 #include <iomanip>
12 #include <iostream>
13 #include <string>
14 #include <chrono>
15 #include <mutex>
16 #include <time.h>
17 
18 using namespace std;
19 
20 namespace Lumiverse {
22  enum LOG_LEVEL {
23  LDEBUG = 0,
24  INFO = 1,
25  WARN = 2,
26  ERR = 3,
27  CRITICAL = 4,
28  FATAL = 5
29  };
30 
38  namespace Logger {
44  static unsigned int logLevel = 0;
45 
51  static ofstream logFile;
52 
59  void setLogFile(string name);
60 
66  string printTime();
67 
74  string printLevel(LOG_LEVEL level);
75 
83  void log(LOG_LEVEL level, string message);
84 
91  void setLogLevel(LOG_LEVEL level);
92  };
93 }
94 #endif
string printTime()
Sticks the current time and date into a string.
Definition: Logger.cpp:16
static ofstream logFile
Log file.
Definition: Logger.h:51
Definition: Layer.h:437
Definition: Logger.h:24
string printLevel(LOG_LEVEL level)
Translates the log level to a string.
Definition: Logger.cpp:34
void setLogLevel(LOG_LEVEL level)
Sets the logLevel.
Definition: Logger.cpp:67
Definition: Logger.h:23
void setLogFile(string name)
Open a log file for writing to instead of writing to stdout.
Definition: Logger.cpp:11
void log(LOG_LEVEL level, string message)
Logs a meesage to the output file.
Definition: Logger.cpp:46
Contains all core Lumiverse functions and variables.
Definition: Device.cpp:2
static unsigned int logLevel
Sets the minimum logging level.
Definition: Logger.h:44
LOG_LEVEL
Log detail level.
Definition: Logger.h:22
Definition: Logger.h:26
Definition: Logger.h:25
Definition: Logger.h:27
Definition: Logger.h:28