log.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_CORE_UTIL_LOG_HPP
13 #define MLPACK_CORE_UTIL_LOG_HPP
14 
15 #include <string>
16 #include <mlpack/mlpack_export.hpp>
17 
18 #include "prefixedoutstream.hpp"
19 #include "nulloutstream.hpp"
20 
21 namespace mlpack {
22 
56 class Log
57 {
58  public:
64  static void Assert(bool condition,
65  const std::string& message = "Assert Failed.");
66 
72  // We only use PrefixedOutStream if the program is compiled with debug
73  // symbols.
74 #ifdef DEBUG
75  static MLPACK_EXPORT util::PrefixedOutStream Debug;
77 #else
78  static MLPACK_EXPORT util::NullOutStream Debug;
80 #endif
81 
84  static MLPACK_EXPORT util::PrefixedOutStream Info;
85 
87  static MLPACK_EXPORT util::PrefixedOutStream Warn;
88 
90  static MLPACK_EXPORT util::PrefixedOutStream Fatal;
91 
93  static std::ostream& cout;
94 };
95 
96 }; // namespace mlpack
97 
98 #endif
Provides a convenient way to give formatted output.
Definition: log.hpp:56
Linear algebra utility functions, generally performed on matrices or vectors.
static MLPACK_EXPORT util::NullOutStream Debug
MLPACK_EXPORT is required for global variables, so that they are properly exported by the Windows com...
Definition: log.hpp:79
static void Assert(bool condition, const std::string &message="Assert Failed.")
Checks if the specified condition is true.
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
Definition: log.hpp:90
static MLPACK_EXPORT util::PrefixedOutStream Info
Prints informational messages if –verbose is specified, prefixed with [INFO ].
Definition: log.hpp:84
static std::ostream & cout
Reference to cout, if necessary.
Definition: log.hpp:93
static MLPACK_EXPORT util::PrefixedOutStream Warn
Prints warning messages prefixed with [WARN ].
Definition: log.hpp:87
Allows us to output to an ostream with a prefix at the beginning of each line, in the same way we wou...
Used for Log::Debug when not compiled with debugging symbols.