bux API Reference 1.6.8
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.
|
#include <FileLog.h>
Public Member Functions | |
C_PathFmtLogSnap (const std::string &pathFmt="%Y%m%d.log") | |
C_PathFmtLogSnap (uintmax_t fsize_in_bytes, const auto &fallbackPaths) | |
void | configPath (const std::string &pathFmt) |
void | configPath (uintmax_t fsize_in_bytes, const auto &fallbackPaths) |
void | enableAutoMkDir (bool yes=true) |
void | setBinaryMode (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. | |
virtual std::ostream * | snap ()=0 |
Snap the current T value. | |
Configurable to automatically change the output path according to the current timestamp.
|
inlineexplicit |
[in] | pathFmt | Path formatting string. The default string "\%Y\%m\%d.log" is for daily report. |
This constructor simply calls configPath(_pathFmt)
Example:
Definition at line 23 of file FileLog.h.
References configPath().
|
inline |
[in] | fsize_in_bytes | Size limit in bytes for each log file. |
[in] | fallbackPaths | Fallback path format list, ... |
This constructor simply calls configPath(fsize_in_bytes, fallbackPaths)
Example:
Definition at line 45 of file FileLog.h.
References configPath().
void bux::C_PathFmtLogSnap::configPath | ( | const std::string & | _pathFmt | ) |
[in] | _pathFmt | The third argument of ANSI C time function strftime(), see MSDN Library for help. Everytime when virtual method getResource() gets called, the current log path is regenerated according to this format string and the current timestamp to compare with the previous one. Were they different, the internal file stream is reopenned on the new path. Here is the format spec for your convience:
|
Example: see construct.
Definition at line 10 of file FileLog.cpp.
References RUNTIME_ERROR.
Referenced by C_PathFmtLogSnap().
|
inline |
void bux::C_PathFmtLogSnap::enableAutoMkDir | ( | bool | yes = true | ) |
[in] | yes | Whether or not to create subdirectory for the openning log path. The default is true. |
If enabled, getResource() always creates the subdir before openning the log path no matter how deep the subdir is.
Since constructor always enables it, you hradly need to call this method explicitly.
Definition at line 141 of file FileLog.cpp.
void bux::C_PathFmtLogSnap::setBinaryMode | ( | bool | enabled | ) |
Definition at line 155 of file FileLog.cpp.
|
overridevirtual |
Snap the current T value.
Implements bux::I_SnapT< std::ostream * >.
Definition at line 164 of file FileLog.cpp.
References RUNTIME_ERROR.