Log

Log class for photon, Log passes all messages to any attached LogSinks, which can then take care of any output which is desired.

Summary
Log class for photon, Log passes all messages to any attached LogSinks, which can then take care of any output which is desired.
Log constructor, initializes log singleton.
Log destructor, destroys log singleton.
Adds a sink to the Log, sinks are given access to all messages passed into the log.
Remove a sink from the log by name.
Remove a sink from the log.
Remove all sinks from log.
Accesses stream, any messages passed into note are given to associated LogSinks with a LogLevel of LOG_NOTE.
Accesses stream, any messages passed into verbose are given to associated LogSinks with a LogLevel of LOG_VERBOSE.
Accesses stream, any messages passed into warning are given to associated LogSinks with a LogLevel of LOG_WARNING.
Accesses stream, any messages passed into error are given to associated LogSinks with a LogLevel of LOG_ERROR.
Accesses stream, any messages passed into critical are given to associated LogSinks with a LogLevel of LOG_CRITICAL.
Flushes the log, is generally not required.

(Con/ De)structors

Log

Log()

Log constructor, initializes log singleton.

~Log

~Log()

Log destructor, destroys log singleton.

Sink Maintenance

addSink

void addSink(LogSinkPtr sink)

Adds a sink to the Log, sinks are given access to all messages passed into the log.

Parameters

sinkPointer to LogSink to add to Log.

removeSink

void removeSink(const std::string &sinkName)

Remove a sink from the log by name.

Parameters

sinkNameName of sink to remove.

removeSink

void removeSink(LogSinkPtr sink)

Remove a sink from the log.

Parameters

sinkPointer to sink to remove.

removeSinks

void removeSinks()

Remove all sinks from log.

Stream Access

note

std::ostream& note()

Accesses stream, any messages passed into note are given to associated LogSinks with a LogLevel of LOG_NOTE.

Returns

Stream to pass errors to.

verbose

std::ostream& verbose()

Accesses stream, any messages passed into verbose are given to associated LogSinks with a LogLevel of LOG_VERBOSE.

Returns

Stream to pass errors to.

warning

std::ostream& warning()

Accesses stream, any messages passed into warning are given to associated LogSinks with a LogLevel of LOG_WARNING.

Returns

Stream to pass errors to.

error

std::ostream& error()

Accesses stream, any messages passed into error are given to associated LogSinks with a LogLevel of LOG_ERROR.

Returns

Stream to pass errors to.

critical

std::ostream& critical()

Accesses stream, any messages passed into critical are given to associated LogSinks with a LogLevel of LOG_CRITICAL.

Returns

Stream to pass errors to.

flush

void flush()

Flushes the log, is generally not required.  Output is handed to the sinks when flush is called.

Base class for all LogSinks to be used with Log, derived classes must define message(LogLevel level, std::string string).
Log()
Log constructor, initializes log singleton.
~Log()
Log destructor, destroys log singleton.
void addSink(LogSinkPtr sink)
Adds a sink to the Log, sinks are given access to all messages passed into the log.
void removeSink(const std::string &sinkName)
Remove a sink from the log by name.
void removeSinks()
Remove all sinks from log.
std::ostream& note()
Accesses stream, any messages passed into note are given to associated LogSinks with a LogLevel of LOG_NOTE.
Enumeration defining severity of an error.
std::ostream& verbose()
Accesses stream, any messages passed into verbose are given to associated LogSinks with a LogLevel of LOG_VERBOSE.
std::ostream& warning()
Accesses stream, any messages passed into warning are given to associated LogSinks with a LogLevel of LOG_WARNING.
std::ostream& error()
Accesses stream, any messages passed into error are given to associated LogSinks with a LogLevel of LOG_ERROR.
std::ostream& critical()
Accesses stream, any messages passed into critical are given to associated LogSinks with a LogLevel of LOG_CRITICAL.
void flush()
Flushes the log, is generally not required.