logger.hpp
Go to the documentation of this file.
1 #ifndef STAN_CALLBACKS_LOGGER_HPP
2 #define STAN_CALLBACKS_LOGGER_HPP
3 
4 #include <string>
5 #include <sstream>
6 
7 namespace stan {
8  namespace callbacks {
9 
10  /**
11  * The <code>logger</code> class defines the callback
12  * used by Stan's algorithms to log messages in the
13  * interfaces. The base class can be used as a no-op
14  * implementation.
15  *
16  * These are the logging levels used by <code>logger</code>,
17  * in order:
18  * 1. debug
19  * 2. info
20  * 3. warn
21  * 4. error
22  * 5. fatal
23  */
24  class logger {
25  public:
26  virtual ~logger() {}
27 
28  /**
29  * Logs a message with debug log level
30  *
31  * @param[in] message message
32  */
33  virtual void debug(const std::string& message) { }
34 
35  /**
36  * Logs a message with debug log level.
37  *
38  * @param[in] message message
39  */
40  virtual void debug(const std::stringstream& message) { }
41 
42  /**
43  * Logs a message with info log level.
44  *
45  * @param[in] message message
46  */
47  virtual void info(const std::string& message) { }
48 
49  /**
50  * Logs a message with info log level.
51  *
52  * @param[in] message message
53  */
54  virtual void info(const std::stringstream& message) { }
55 
56  /**
57  * Logs a message with warn log level.
58  *
59  * @param[in] message message
60  */
61  virtual void warn(const std::string& message) { }
62 
63  /**
64  * Logs a message with warn log level.
65  *
66  * @param[in] message message
67  */
68  virtual void warn(const std::stringstream& message) { }
69 
70  /**
71  * Logs an error with error log level.
72  *
73  * @param[in] message message
74  */
75  virtual void error(const std::string& message) { }
76 
77  /**
78  * Logs an error with error log level.
79  *
80  * @param[in] message message
81  */
82  virtual void error(const std::stringstream& message) { }
83 
84  /**
85  * Logs an error with fatal log level.
86  *
87  * @param[in] message message
88  */
89  virtual void fatal(const std::string& message) { }
90 
91  /**
92  * Logs an error with fatal log level.
93  *
94  * @param[in] message message
95  */
96  virtual void fatal(const std::stringstream& message) { }
97  };
98  }
99 }
100 
101 #endif
virtual void debug(const std::stringstream &message)
Definition: logger.hpp:40
virtual void debug(const std::string &message)
Definition: logger.hpp:33
virtual void info(const std::stringstream &message)
Definition: logger.hpp:54
virtual void warn(const std::string &message)
Definition: logger.hpp:61
virtual void fatal(const std::stringstream &message)
Definition: logger.hpp:96
def callbacks(model_name, group, tensorboard=True)
Definition: regression.py:123
virtual void error(const std::stringstream &message)
Definition: logger.hpp:82
virtual void error(const std::string &message)
Definition: logger.hpp:75
virtual void info(const std::string &message)
Definition: logger.hpp:47
virtual void warn(const std::stringstream &message)
Definition: logger.hpp:68
virtual void fatal(const std::string &message)
Definition: logger.hpp:89
enum BeamMode string