rvm  1.11
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
logger.h
Go to the documentation of this file.
1 #ifndef __logger_h__
2 #define __logger_h__
3 
4 #ifdef HAVE_UNISTD_H
5 #include <unistd.h>
6 #endif
7 
8 #include <iostream>
9 #include <string>
10 
11 #include "asserts.h"
12 #include "types.h"
13 #include "fs.h"
14 #include "rconfig.h"
15 
16 /** Write information to a log file */
17 class log_manager {
18 public:
19  log_manager();
20 
21  void clear(void);
22  void init(void);
23  const bool initialized(void) const;
24 
25  void write(
26  const std::string& a_str,
27  const uint16 a_indention = 0,
28  const configuration_manager::logging_type a_logging_level
30  const pid_t a_pid = pid()
31  );
32 
33  void set_error_logging(bool a_b);
34 
35 private:
36  bool m_new_line;
37  std::ofstream m_out;
40 };
41 
42 extern log_manager logger;
43 
44 #endif
const pid_t pid(void)
Return the PID of this process.
Definition: fs.cc:162
Basic types definitions and templates.
bool m_use_error_logging_level
Definition: logger.h:39
std::ofstream m_out
Definition: logger.h:37
void set_error_logging(bool a_b)
Use error-logging-level instead of logging-level.
Definition: logger.cc:130
void write(const std::string &a_str, const uint16 a_indention=0, const configuration_manager::logging_type a_logging_level=configuration_manager::logging_manager, const pid_t a_pid=pid())
Write a string to the log file.
Definition: logger.cc:96
const bool initialized(void) const
The initialized state of the log manager.
Definition: logger.cc:90
log_manager logger
The global log manager.
Definition: logger.cc:138
Write information to a log file.
Definition: logger.h:17
void clear(void)
Clear the log manager.
Definition: logger.cc:32
void init(void)
Initialize the log manager.
Definition: logger.cc:42
bool m_new_line
Definition: logger.h:36
bool m_initialized
Definition: logger.h:38
log_manager()
C'tor.
Definition: logger.cc:22