27 #ifndef LUNCHBOX_LOG_H 28 #define LUNCHBOX_LOG_H 31 #include <lunchbox/compiler.h> 72 class Log :
public std::ostream
76 LUNCHBOX_API
void indent();
79 LUNCHBOX_API
void exdent();
103 static LUNCHBOX_API
Log& instance();
106 static LUNCHBOX_API
Log& instance(
const char* file,
const int line);
109 static LUNCHBOX_API
void exit();
112 static LUNCHBOX_API
void reset();
115 static std::string& getLogLevelString();
118 static LUNCHBOX_API
int getLogLevel(
const char* level);
121 static LUNCHBOX_API
void setOutput(std::ostream& stream);
124 static LUNCHBOX_API
bool setOutput(
const std::string& file);
127 static LUNCHBOX_API std::ostream& getOutput();
137 static LUNCHBOX_API
void setClock(
Clock* clock);
139 static const Clock& getClock();
141 LUNCHBOX_API
void setThreadName(
const std::string& name);
142 LUNCHBOX_API
const std::string& getThreadName()
const;
145 detail::Log*
const impl_;
154 Log& operator=(
const Log&);
156 void setLogInfo(
const char* file,
const int line);
164 LUNCHBOX_API std::ostream&
indent(std::ostream& os);
166 LUNCHBOX_API std::ostream&
exdent(std::ostream& os);
169 LUNCHBOX_API std::ostream&
disableFlush(std::ostream& os);
171 LUNCHBOX_API std::ostream&
enableFlush(std::ostream& os);
173 LUNCHBOX_API std::ostream&
forceFlush(std::ostream& os);
178 LUNCHBOX_API std::ostream&
enableHeader(std::ostream& os);
194 (lunchbox::Log::level >= lunchbox::LOG_ERROR) && \ 195 lunchbox::Log::instance(__FILE__, __LINE__) 197 #define LBWARN LBERROR 200 (lunchbox::Log::level >= lunchbox::LOG_INFO) && \ 201 lunchbox::Log::instance(__FILE__, __LINE__) 204 (lunchbox::Log::level >= lunchbox::LOG_DEBUG) && \ 205 lunchbox::Log::instance(__FILE__, __LINE__) 210 lunchbox::Log::instance(__FILE__, __LINE__) 214 (lunchbox::Log::level >= lunchbox::LOG_VERB) && \ 215 lunchbox::Log::instance(__FILE__, __LINE__) 222 #define LBLOG(topic) \ 223 (lunchbox::Log::topics & (topic)) && \ 224 lunchbox::Log::instance(__FILE__, __LINE__) 230 #define LBTHROW(exc) \ 232 LBDEBUG << exc.what() << std::endl; \ 236 #endif // LUNCHBOX_LOG_H std::ostream & enableFlush(std::ostream &os)
Re-enable flushing of the Log stream.
std::ostream & exdent(std::ostream &os)
Decrease the indentation level of the Log stream.
Defines export visibility macros for library Lunchbox.
Basic type definitions not provided by the operating system.
bool exit()
De-initialize the Lunchbox base classes.
A class for time measurements.
static int level
The current log level.
LogTopic
The logging topics.
LogLevel
The logging levels.
Output informational messages.
std::ostream & enableHeader(std::ostream &os)
Re-enable printing of the Log header.
std::ostream & stopBlock(std::ostream &os)
Exdent, denable flush and header to stop block print.
std::ostream & disableHeader(std::ostream &os)
Disable printing of the Log header for subsequent lines.
Output critical errors and warnings.
Output debugging information.
Abstraction layer and common utilities for multi-threaded programming.
std::ostream & forceFlush(std::ostream &os)
Flush the Log stream regardless of the auto-flush state.
std::ostream & indent(std::ostream &os)
Increases the indentation level of the Log stream, causing subsequent lines to be intended by four ch...
Log exception within LBTHROW.
static unsigned topics
The current log topics.
Log topics for other namespaces start here.
void perThreadDelete(T *object)
Default PerThread destructor deleting the object.
std::ostream & startBlock(std::ostream &os)
Indent, disable flush and header for block printing.
std::ostream & disableFlush(std::ostream &os)
Disable flushing of the Log stream.