Utilities
Utilities header only library
utils::LogEntry Class Reference

A single entry for the logging system. More...

Inherited by ulog::Entry.

Public Types

enum  Type {
  debug, info, warning, error,
  critical, _unspecified
}
 Defines the character of a LogEntry.
 

Public Member Functions

 LogEntry (const std::string &message)
 
 LogEntry (Type type, const std::string &message, const std::string &caller_name)
 
Type GetType () const
 
const std::string & GetMessage () const
 
const std::string & GetCaller () const
 
virtual std::string ToString (const std::string &time_format="%Y-%m-%d %H:%M:%S") const
 Print the entry to a string. More...
 
bool IsRead () const
 
void Read ()
 Set the entry to is_read.
 

Static Public Member Functions

static std::vector< Type > GetWECTypes ()
 
static std::vector< Type > GetIWECTypes ()
 
static std::string TypeToString (Type type)
 
static std::wstring TypeToWstring (Type type)
 

Friends

std::ostream & operator<< (std::ostream &os, const LogEntry &entry)
 Print a LogEntry to output stream.
 
std::ostream & operator<< (std::ostream &os, const std::vector< LogEntry > &v)
 Print a vector of LogEntries to output stream.
 
std::ostream & operator<< (std::ostream &os, const std::vector< std::shared_ptr< LogEntry >> &v)
 Print a vector of LogEntries to output stream.
 

Detailed Description

A single entry for the logging system.

Member Function Documentation

◆ ToString()

virtual std::string utils::LogEntry::ToString ( const std::string &  time_format = "%Y-%m-%d %H:%M:%S") const
virtual

Print the entry to a string.

Note
The string format is "[type] caller: message".