OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022

#include <FormattedStream.hpp>

Inheritance diagram for FormattedStreamLogger:
[legend]
Collaboration diagram for FormattedStreamLogger:
[legend]

Public Member Functions

 FormattedStreamLogger (const std::string &format, map_of_functions named_functions={}, vector_of_functions numbered_functions={}, std::ostream &stream=std::cout)
 
 FormattedStreamLogger (const std::string &format, std::ostream &stream)
 
 ~FormattedStreamLogger () override
 
void log (int severity, const std::string &s) override
 
- Public Member Functions inherited from LogFacility
virtual ~LogFacility ()
 
virtual void log (LogSeverity severity, const std::string &s)
 

Detailed Description

Log facility allowing text to be generated around messages.

Format String

%s - message from user
%% - literal %
%{function_name}f - function from map_of_functions
%[function_index]f - function from vector_of_functions
%l - severity lowercase
%u - severity uppercase
%m - severity mixed case
%n - severity number
%t - time
%{time_string} - time
%{local|gmt|utc,time_string} - time

If the user message (%s) is omitted, the entire format string is treated as a prefix and the user message is automatically added to the end.

Definition at line 57 of file FormattedStream.hpp.

Constructor & Destructor Documentation

◆ FormattedStreamLogger() [1/2]

FormattedStreamLogger ( const std::string format,
map_of_functions  named_functions = {},
vector_of_functions  numbered_functions = {},
std::ostream &  stream = std::cout 
)
explicit

Create a new log facility with the given format, with optional function containers and a specific output stream.

Parameters
formatstring with which to format messages
named_functionsmap of functions referred to by the format string
numbered_functionsvector of functions referred to by the format string
streamstream to which to print

◆ FormattedStreamLogger() [2/2]

FormattedStreamLogger ( const std::string format,
std::ostream &  stream 
)
inline

Create a new log facility without external function calls.

Parameters
formatstring with which to format messages
streamstream to which to print

Definition at line 80 of file FormattedStream.hpp.

◆ ~FormattedStreamLogger()

~FormattedStreamLogger ( )
override

Member Function Documentation

◆ log()

void log ( int  severity,
const std::string s 
)
overridevirtual

Print a message to this log facility, with a given severity.

Parameters
severitynumeric severity level
smessage to log

Implements LogFacility.


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