Avara3D 0.2.0
C++ API reference
a3d::log::Log Class Reference

Dispatches severity-filtered log messages to one or more LogSink objects. More...

#include <a3d/log/Log.h>

Public Member Functions

 Log ()
 Creates an unnamed Log with default thresholds and no sinks. More...
 
 Log (const std::string &name, std::unique_ptr< LogSink > sink, Level level=DEFAULT_LEVEL, Level flushLevel=DEFAULT_FLUSH_LEVEL)
 Creates a named Log that takes ownership of sink. More...
 
 Log (const std::string &name, std::vector< std::unique_ptr< LogSink > > sinks, Level level=DEFAULT_LEVEL, Level flushLevel=DEFAULT_FLUSH_LEVEL)
 Creates a named Log that takes ownership of sinks. More...
 
const std::string & name () const
 Returns the name included in formatted log output. More...
 
const std::vector< std::unique_ptr< LogSink > > & sinks () const
 Returns the sinks owned by the Log. More...
 
Level level () const
 Returns the minimum severity currently emitted by the Log. More...
 
void level (Level level)
 Sets the minimum emitted severity; Level::Off disables message emission. More...
 
Level flushLevel () const
 Returns the severity threshold that triggers an automatic sink flush. More...
 
void flushLevel (Level flushLevel)
 Sets the severity threshold that triggers an automatic sink flush. More...
 
void trace (const std::string &msg)
 Emits msg at Trace severity when enabled. More...
 
void debug (const std::string &msg)
 Emits msg at Debug severity when enabled. More...
 
void info (const std::string &msg)
 Emits msg at Info severity when enabled. More...
 
void warn (const std::string &msg)
 Emits msg at Warn severity when enabled. More...
 
void error (const std::string &msg)
 Emits msg at Error severity when enabled. More...
 
void fatal (const std::string &msg)
 Emits msg at Fatal severity when enabled. More...
 
void flush ()
 Flushes every owned sink. More...
 

Detailed Description

Dispatches severity-filtered log messages to one or more LogSink objects.

A Log owns its sinks. Messages below level() are ignored; messages at or above flushLevel() cause all sinks to be flushed after the message is dispatched.

Definition at line 57 of file Log.h.

Constructor & Destructor Documentation

◆ Log() [1/3]

a3d::log::Log::Log ( )

Creates an unnamed Log with default thresholds and no sinks.

◆ Log() [2/3]

a3d::log::Log::Log ( const std::string &  name,
std::unique_ptr< LogSink sink,
Level  level = DEFAULT_LEVEL,
Level  flushLevel = DEFAULT_FLUSH_LEVEL 
)

Creates a named Log that takes ownership of sink.

A null sink is accepted and leaves the Log with no sinks.

◆ Log() [3/3]

a3d::log::Log::Log ( const std::string &  name,
std::vector< std::unique_ptr< LogSink > >  sinks,
Level  level = DEFAULT_LEVEL,
Level  flushLevel = DEFAULT_FLUSH_LEVEL 
)

Creates a named Log that takes ownership of sinks.

Member Function Documentation

◆ debug()

void a3d::log::Log::debug ( const std::string &  msg)

Emits msg at Debug severity when enabled.

◆ error()

void a3d::log::Log::error ( const std::string &  msg)

Emits msg at Error severity when enabled.

◆ fatal()

void a3d::log::Log::fatal ( const std::string &  msg)

Emits msg at Fatal severity when enabled.

◆ flush()

void a3d::log::Log::flush ( )

Flushes every owned sink.

◆ flushLevel() [1/2]

Level a3d::log::Log::flushLevel ( ) const

Returns the severity threshold that triggers an automatic sink flush.

◆ flushLevel() [2/2]

void a3d::log::Log::flushLevel ( Level  flushLevel)

Sets the severity threshold that triggers an automatic sink flush.

◆ info()

void a3d::log::Log::info ( const std::string &  msg)

Emits msg at Info severity when enabled.

◆ level() [1/2]

Level a3d::log::Log::level ( ) const

Returns the minimum severity currently emitted by the Log.

◆ level() [2/2]

void a3d::log::Log::level ( Level  level)

Sets the minimum emitted severity; Level::Off disables message emission.

◆ name()

const std::string & a3d::log::Log::name ( ) const

Returns the name included in formatted log output.

◆ sinks()

const std::vector< std::unique_ptr< LogSink > > & a3d::log::Log::sinks ( ) const

Returns the sinks owned by the Log.

◆ trace()

void a3d::log::Log::trace ( const std::string &  msg)

Emits msg at Trace severity when enabled.

◆ warn()

void a3d::log::Log::warn ( const std::string &  msg)

Emits msg at Warn severity when enabled.


The documentation for this class was generated from the following file: