rippled
|
Manages a system file containing logged output. More...
Public Member Functions | |
File () | |
Construct with no associated system file. More... | |
~File ()=default | |
Destroy the object. More... | |
bool | isOpen () const noexcept |
Determine if a system file is associated with the log. More... | |
bool | open (boost::filesystem::path const &path) |
Associate a system file with the log. More... | |
bool | closeAndReopen () |
Close and re-open the system file associated with the log This assists in interoperating with external log management tools. More... | |
void | close () |
Close the system file if it is open. More... | |
void | write (char const *text) |
write to the log file. More... | |
void | writeln (char const *text) |
write to the log file and append an end of line marker. More... | |
void | write (std::string const &str) |
Write to the log file using std::string. More... | |
void | writeln (std::string const &str) |
Private Attributes | |
std::unique_ptr< std::ofstream > | m_stream |
boost::filesystem::path | m_path |
Manages a system file containing logged output.
The system file remains open during program execution. Interfaces are provided for interoperating with standard log management tools like logrotate(8): http://linuxcommand.org/man_pages/logrotate8.html
ripple::Logs::File::File | ( | ) |
|
default |
Destroy the object.
If a system file is associated, it will be flushed and closed.
|
noexcept |
bool ripple::Logs::File::open | ( | boost::filesystem::path const & | path | ) |
Associate a system file with the log.
If the file does not exist an attempt is made to create it and open it for writing. If the file already exists an attempt is made to open it for appending. If a system file is already associated with the log, it is closed first.
true
if the file was opened. bool ripple::Logs::File::closeAndReopen | ( | ) |
void ripple::Logs::File::close | ( | ) |
void ripple::Logs::File::write | ( | char const * | text | ) |
void ripple::Logs::File::writeln | ( | char const * | text | ) |
void ripple::Logs::File::write | ( | std::string const & | str | ) |
Write to the log file using std::string.
void ripple::Logs::File::writeln | ( | std::string const & | str | ) |
|
private |