bux API Reference 1.9.0
Static library of whatever are seen required in general purpose but not directly supported from Modern C++. Or whatever reusable originated from my side projects.
Loading...
Searching...
No Matches
bux::C_PathFmtLogSnap Class Reference

#include <FileLog.h>

Inheritance diagram for bux::C_PathFmtLogSnap:

Public Member Functions

 C_PathFmtLogSnap (const std::chrono::time_zone *tz)
 
 C_PathFmtLogSnap (bool use_local_time=true)
 
C_PathFmtLogSnapconfigPath (const std::string &pathFmt)
 
C_PathFmtLogSnapconfigPath (uintmax_t fsize_in_bytes, const auto &fallbackPaths)
 
C_PathFmtLogSnapenableAutoMkDir (bool yes=true)
 
C_PathFmtLogSnapsetBinaryMode (bool enabled)
 
std::ostream * snap () override
 Snap the current T value.
 
- Public Member Functions inherited from bux::I_SnapT< std::ostream * >
virtual ~I_SnapT ()=default
 Pointer deletion is hereby granted.
 

Detailed Description

Configurable to automatically change the output path according to the current timestamp.

Examples
test/smoke_filtlog.cpp, and test/smoke_paralog.cpp.

Definition at line 16 of file FileLog.h.

Constructor & Destructor Documentation

◆ C_PathFmtLogSnap() [1/2]

bux::C_PathFmtLogSnap::C_PathFmtLogSnap ( const std::chrono::time_zone * tz)
explicit

Definition at line 11 of file FileLog.cpp.

References configPath().

◆ C_PathFmtLogSnap() [2/2]

bux::C_PathFmtLogSnap::C_PathFmtLogSnap ( bool use_local_time = true)
inlineexplicit

Definition at line 24 of file FileLog.h.

Member Function Documentation

◆ configPath() [1/2]

C_PathFmtLogSnap & bux::C_PathFmtLogSnap::configPath ( const std::string & _pathFmt)
Parameters
[in]_pathFmtUsed as fmt parameter of std::vformat() with one single extra argument to format, ie. timestamp for now.
Returns
*this

Each formatted path is the target file for the moment when something is to be logged on demand.

Definition at line 16 of file FileLog.cpp.

References RUNTIME_ERROR.

Referenced by C_PathFmtLogSnap().

Here is the caller graph for this function:

◆ configPath() [2/2]

C_PathFmtLogSnap & bux::C_PathFmtLogSnap::configPath ( uintmax_t fsize_in_bytes,
const auto & fallbackPaths )
inline
Parameters
[in]fsize_in_bytesMax bytes per log file.
[in]fallbackPathsArray of strings used in turn as fmt parameter of std::vformat() with one single extra argument to format, ie. timestamp for now.
Returns
*this

Each formatted path is the target file for the moment when something is to be logged on demand.

Definition at line 26 of file FileLog.h.

◆ enableAutoMkDir()

C_PathFmtLogSnap & bux::C_PathFmtLogSnap::enableAutoMkDir ( bool yes = true)
Parameters
[in]yesWhether or not to create subdirectory for the openning log path. The default is true.
Returns
*this

If enabled, missing subdirs are always created before opening the log file no matter how deep the subdir is.

Definition at line 33 of file FileLog.cpp.

◆ setBinaryMode()

C_PathFmtLogSnap & bux::C_PathFmtLogSnap::setBinaryMode ( bool enabled)
Parameters
[in]enabledWhether or not to open log files in binary mode. The default is false.
Returns
*this

Definition at line 44 of file FileLog.cpp.

◆ snap()

std::ostream * bux::C_PathFmtLogSnap::snap ( )
overridevirtual

Snap the current T value.

Implements bux::I_SnapT< std::ostream * >.

Definition at line 57 of file FileLog.cpp.

References RUNTIME_ERROR.


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