Turi Create  4.0
logger.hpp File Reference
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cstdarg>
#include <functional>
#include <core/parallel/pthread_h.h>
#include <timer/timer.hpp>
#include <core/logging/fail_method.hpp>
#include <core/logging/backtrace.hpp>
#include <core/logging/error.hpp>
#include <core/system/cppipc/server/cancel_ops.hpp>
#include <core/util/code_optimization.hpp>
#include <process/process_util.hpp>

Go to the source code of this file.

Classes

class  file_logger
 
struct  log_dispatch< dostuff >
 

Macros

#define LOG_FATAL   7
 
#define LOG_ERROR   6
 
#define LOG_WARNING   5
 
#define LOG_EMPH   3
 
#define LOG_INFO   2
 
#define LOG_DEBUG   1
 
#define LOG_EVERYTHING   0
 
#define OUTPUTLEVEL   LOG_DEBUG
 
#define COLOROUTPUT
 If set, logs to screen will be printed in color.
 
#define logger(lvl, fmt, ...)
 
#define logstream(lvl)
 
#define logger_once(lvl, fmt, ...)
 
#define logstream_once(lvl)
 
#define logger_ontick(sec, lvl, fmt, ...)
 
#define logstream_ontick(sec, lvl)
 
#define logprogress(fmt, ...)   logger(LOG_PROGRESS, fmt, ##__VA_ARGS__)
 
#define logprogress_stream   logstream(LOG_PROGRESS)
 
#define logprogress_ontick(sec, fmt, ...)   logger_ontick(sec, LOG_PROGRESS, fmt, ##__VA_ARGS__)
 
#define logprogress_stream_ontick(sec)   logstream_ontick(sec, LOG_PROGRESS)
 

Functions

file_loggerglobal_logger ()
 

Detailed Description

Usage: First include logger.hpp. To logger, use the logger() function There are 2 output levels. A "soft" output level which is set by calling global_logger.set_log_level(), as well as a "hard" output level OUTPUTLEVEL which is set in the source code (logger.h).

when you call "logger()" with a loglevel and if the loglevel is greater than both of the output levels, the string will be written. written to a logger file. Otherwise, logger() has no effect.

The difference between the hard level and the soft level is that the soft level can be changed at runtime, while the hard level optimizes away logging calls at compile time.

Definition in file logger.hpp.

Function Documentation

◆ global_logger()

file_logger& global_logger ( )

Gets a reference to the global logger which all the logging macros use.