Base module
FileChannel
Log channel that writes formatted messages to a file.
#include <icy/logger.h>
class FileChannelDefined in src/base/include/icy/logger.h:479
- Inherits
LogChannel
List of all members
| Name | Kind | Owner |
|---|---|---|
FileChannel | function | Declared here |
~FileChannel | function | Declared here |
write | function | Declared here |
setPath | function | Declared here |
path | function | Declared here |
_fstream | variable | Declared here |
_path | variable | Declared here |
open | function | Declared here |
close | function | Declared here |
LogChannel | function | Inherited from LogChannel |
~LogChannel | function | Inherited from LogChannel |
write | function | Inherited from LogChannel |
write | function | Inherited from LogChannel |
format | function | Inherited from LogChannel |
name | function | Inherited from LogChannel |
level | function | Inherited from LogChannel |
timeFormat | function | Inherited from LogChannel |
setLevel | function | Inherited from LogChannel |
setTimeFormat | function | Inherited from LogChannel |
setFilter | function | Inherited from LogChannel |
_name | variable | Inherited from LogChannel |
_level | variable | Inherited from LogChannel |
_timeFormat | variable | Inherited from LogChannel |
_filter | variable | Inherited from LogChannel |
Inherited from LogChannel
| Kind | Name | Description |
|---|---|---|
function | LogChannel | |
function | ~LogChannel virtual | Defaulted destructor. |
function | write virtual | Writes a log stream entry to this channel. |
function | write virtual | Writes a plain message to this channel. |
function | format virtual | Formats a log stream entry into the given output stream. |
function | name const inline | Returns the channel name. |
function | level const inline | Returns the minimum severity level. |
function | timeFormat const inline | Returns the timestamp format string. |
function | setLevel inline | Sets the minimum severity level. |
function | setTimeFormat inline | Sets the timestamp format string. |
function | setFilter inline | Sets a realm filter; only messages whose realm matches are written. |
variable | _name | |
variable | _level | |
variable | _timeFormat | |
variable | _filter |
Public Methods
| Return | Name | Description |
|---|---|---|
FileChannel | ||
~FileChannel virtual | ||
void | write virtual override | Formats and writes the log stream entry to the file. Opens the file on first write if not already open. |
void | setPath | Sets the file path and reopens the file stream. |
std::string | path const | Returns the current log file path. |
FileChannel
FileChannel(std::string name, std::string path, Level level = Level::Debug, std::string timeFormat = "%H:%M:%S")Defined in src/base/include/icy/logger.h:486
Parameters
| Parameter | Type | Description |
|---|---|---|
name | std::string | Unique channel name. |
path | std::string | Path to the output log file. Directories are created if needed. |
level | Level | Minimum severity level; messages below this level are dropped. |
timeFormat | std::string | strftime-compatible format string for timestamps. |
~FileChannel
virtual
virtual ~FileChannel()Defined in src/base/include/icy/logger.h:489
write
virtual override
virtual void write(const LogStream & stream) overrideDefined in src/base/include/icy/logger.h:494
Formats and writes the log stream entry to the file. Opens the file on first write if not already open.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
stream | const LogStream & | The log stream to write. |
setPath
void setPath(const std::string & path)Defined in src/base/include/icy/logger.h:498
Sets the file path and reopens the file stream.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | const std::string & | Path to the new log file. |
path
const
std::string path() constDefined in src/base/include/icy/logger.h:502
Returns the current log file path.
Returns
Absolute or relative path to the log file.
Protected Attributes
_fstream
std::ofstream _fstreamDefined in src/base/include/icy/logger.h:509
_path
std::string _pathDefined in src/base/include/icy/logger.h:510
Protected Methods
open
virtual
virtual void open()Defined in src/base/include/icy/logger.h:505
close
virtual
virtual void close()