libfilezilla
Public Member Functions | Protected Attributes | List of all members
logger_interface Class Referenceabstract

Abstract interface for logging strings. More...

#include <logger.hpp>

Inheritance diagram for logger_interface:
Inheritance graph
[legend]

Public Member Functions

 logger_interface (logger_interface const &)=delete
 
logger_interfaceoperator= (logger_interface const &)=delete
 
virtual void do_log (logmsg::type t, std::wstring &&msg)=0
 The one thing you need to override.
 
template<typename String , typename... Args>
void log (logmsg::type t, String &&fmt, Args &&...args)
 
template<typename String , typename... Args>
void log_u (logmsg::type t, String &&fmt, Args const &...args)
 
template<typename String >
void log_raw (logmsg::type t, String &&msg)
 Logs the raw string, it is not treated as format string.
 
template<typename String >
void log_u_raw (logmsg::type t, String &&msg)
 
bool should_log (logmsg::type t) const
 Is any of the passed log levels set.
 
logmsg::type levels () const
 Returns all currently enabled log levels.
 
virtual void set_all (logmsg::type t)
 Sets which message types should be logged.
 
void set (logmsg::type t, bool flag)
 Sets whether the given types should be logged.
 
virtual void enable (logmsg::type t)
 Enables logging for the passed message types.
 
virtual void disable (logmsg::type t)
 Disables logging for the passed message types.
 

Protected Attributes

std::atomic< uint64_t > level_ {logmsg::status | logmsg::error | logmsg::command | logmsg::reply}
 

Detailed Description

Abstract interface for logging strings.

Each log message has a type. Logging can be enabled or disabled for each type.

The actual string to log gets assembled from the format string and its arguments only if the type is supposed to be logged.

Examples
aio.cpp, https.cpp, and raw_https.cpp.

Member Function Documentation

◆ log()

void log ( logmsg::type  t,
String &&  fmt,
Args &&...  args 
)
inline

The

  • fmt argument is a format string suitable for fz::sprintf

Assumes that all narrow string arguments are in the locale's current encoding.

Examples
aio.cpp, and https.cpp.

◆ log_u()

void log_u ( logmsg::type  t,
String &&  fmt,
Args const &...  args 
)
inline

The

  • fmt argument is a format string suitable for fz::sprintf

Assumes that all narrow string arguments, excluding the format string, are in UTF-8


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