RIT VEXU Core API
Loading...
Searching...
No Matches
Logger Class Reference

Class to simplify writing to files. More...

#include <logger.h>

Public Member Functions

 Logger (const std::string &filename)
 Create a logger that will save to a file.
 
 Logger (const Logger &l)=delete
 copying not allowed
 
Loggeroperator= (const Logger &l)=delete
 copying not allowed
 
void Log (const std::string &s)
 Write a string to the log.
 
void Log (LogLevel level, const std::string &s)
 Write a string to the log with a loglevel.
 
void Logln (const std::string &s)
 Write a string and newline to the log.
 
void Logln (LogLevel level, const std::string &s)
 Write a string and a newline to the log with a loglevel.
 
void Logf (const char *fmt,...)
 Write a formatted string to the log.
 
void Logf (LogLevel level, const char *fmt,...)
 Write a formatted string to the log with a loglevel.
 

Static Public Attributes

static constexpr int MAX_FORMAT_LEN = 512
 maximum size for a string to be before it's written
 

Detailed Description

Class to simplify writing to files.

Constructor & Destructor Documentation

◆ Logger()

Logger::Logger ( const std::string & filename)
explicit

Create a logger that will save to a file.

Parameters
filenamethe file to save to

Member Function Documentation

◆ Log() [1/2]

void Logger::Log ( const std::string & s)

Write a string to the log.

Parameters
sthe string to write

◆ Log() [2/2]

void Logger::Log ( LogLevel level,
const std::string & s )

Write a string to the log with a loglevel.

Parameters
levelthe level to write. DEBUG, NOTICE, WARNING, ERROR, CRITICAL, TIME
sthe string to write

◆ Logf() [1/2]

void Logger::Logf ( const char * fmt,
... )

Write a formatted string to the log.

Parameters
fmtthe format string (like printf)
...the args

◆ Logf() [2/2]

void Logger::Logf ( LogLevel level,
const char * fmt,
... )

Write a formatted string to the log with a loglevel.

Parameters
levelthe level to write. DEBUG, NOTICE, WARNING, ERROR, CRITICAL, TIME
fmtthe format string (like printf)
...the args

◆ Logln() [1/2]

void Logger::Logln ( const std::string & s)

Write a string and newline to the log.

Parameters
sthe string to write

◆ Logln() [2/2]

void Logger::Logln ( LogLevel level,
const std::string & s )

Write a string and a newline to the log with a loglevel.

Parameters
levelthe level to write. DEBUG, NOTICE, WARNING, ERROR, CRITICAL, TIME
sthe string to write

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