libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
LoggingDriver Class Referenceabstract

Abstract backend a Logger fans a formatted line out to. More...

#include <Logger.h>

Inheritance diagram for LoggingDriver:
[legend]

Public Member Functions

virtual bool init (const LogConfig &config)=0
 Opens whatever handle/socket/file this backend needs, using only fields from config (nothing hardcoded).
 
virtual void shutdown ()=0
 Releases whatever init() acquired.
 
virtual void write (LogLevel level, const char *line, size_t len)=0
 Writes one already-formatted, newline-terminated line.
 
virtual const char * name () const =0
 Short identifier for diagnostics (eg. "UDP", "File").
 

Detailed Description

Abstract backend a Logger fans a formatted line out to.

Every method must be safe to call from any thread and must not block indefinitely - Logger already serializes all calls to a given Logger instance under its own mutex, so a backend does not need its own locking for write(), but must still not do something like an unbounded blocking socket send.

Definition at line 152 of file Logger.h.

Member Function Documentation

◆ init()

virtual bool LoggingDriver::init ( const LogConfig & config)
pure virtual

Opens whatever handle/socket/file this backend needs, using only fields from config (nothing hardcoded).

Returning false leaves the backend registered but inert - Logger will simply skip it in dispatch() rather than treat it as fatal, so eg. a missing SD card or unattached USB Gecko degrades gracefully instead of taking the rest of logging down with it.

Implemented in LoggerFile, OgcLoggerSysReport, OgcLoggerUdp, OgcLoggerUsbGecko, WutLoggerOSReport, WutLoggerUdp, and WutLoggerUsbSerial.

◆ name()

virtual const char * LoggingDriver::name ( ) const
pure virtual

Short identifier for diagnostics (eg. "UDP", "File").

Implemented in LoggerFile, OgcLoggerSysReport, OgcLoggerUdp, OgcLoggerUsbGecko, WutLoggerOSReport, WutLoggerUdp, and WutLoggerUsbSerial.

◆ shutdown()

virtual void LoggingDriver::shutdown ( )
pure virtual

Releases whatever init() acquired.

Must be safe to call even if init() was never called or returned false.

Implemented in LoggerFile, OgcLoggerSysReport, OgcLoggerUdp, OgcLoggerUsbGecko, WutLoggerOSReport, WutLoggerUdp, and WutLoggerUsbSerial.

◆ write()

virtual void LoggingDriver::write ( LogLevel level,
const char * line,
size_t len )
pure virtual

Writes one already-formatted, newline-terminated line.

len does not include the terminating NUL. Must not allocate.

Implemented in LoggerFile, OgcLoggerSysReport, OgcLoggerUdp, OgcLoggerUsbGecko, WutLoggerOSReport, WutLoggerUdp, and WutLoggerUsbSerial.


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