Class to simplify writing to files.
More...
#include <logger.h>
|
| Logger (const std::string &filename) |
| Create a logger that will save to a file.
|
|
| Logger (const Logger &l)=delete |
| copying not allowed
|
|
Logger & | operator= (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 constexpr int | MAX_FORMAT_LEN = 512 |
| maximum size for a string to be before it's written
|
|
Class to simplify writing to files.
◆ Logger()
Logger::Logger |
( |
const std::string & | filename | ) |
|
|
explicit |
Create a logger that will save to a file.
- Parameters
-
filename | the file to save to |
◆ Log() [1/2]
void Logger::Log |
( |
const std::string & | s | ) |
|
Write a string to the log.
- Parameters
-
◆ Log() [2/2]
void Logger::Log |
( |
LogLevel | level, |
|
|
const std::string & | s ) |
Write a string to the log with a loglevel.
- Parameters
-
level | the level to write. DEBUG, NOTICE, WARNING, ERROR, CRITICAL, TIME |
s | the string to write |
◆ Logf() [1/2]
void Logger::Logf |
( |
const char * | fmt, |
|
|
| ... ) |
Write a formatted string to the log.
- Parameters
-
fmt | the 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
-
level | the level to write. DEBUG, NOTICE, WARNING, ERROR, CRITICAL, TIME |
fmt | the 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
-
◆ 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
-
level | the level to write. DEBUG, NOTICE, WARNING, ERROR, CRITICAL, TIME |
s | the string to write |
The documentation for this class was generated from the following files: