sptk2 logo
SPTK Home Page
Public Member Functions | List of all members
sptk::FileLogEngine Class Reference

#include <FileLogEngine.h>

Inheritance diagram for sptk::FileLogEngine:
sptk::LogEngine sptk::Thread

Public Member Functions

 FileLogEngine (const fs::path &fileName)
 
 ~FileLogEngine () override
 Destructor.
 
void saveMessage (const Logger::UMessage &message) override
 
void reset () override
 
- Public Member Functions inherited from sptk::LogEngine
virtual void saveMessage (const Logger::UMessage &message)=0
 
 LogEngine (const String &logEngineName)
 
 ~LogEngine () noexcept override
 
virtual void reset ()
 
void options (int ops)
 
size_t options () const
 
void option (int options, bool flag)
 
void priority (LogPriority prt)
 
virtual void minPriority (LogPriority prt)
 
virtual LogPriority minPriority () const
 
- Public Member Functions inherited from sptk::Thread
 Thread (const String &name, const std::shared_ptr< ThreadManager > &threadManager=nullptr)
 
virtual ~Thread ()
 
virtual void run ()
 
bool running () const
 
virtual void threadFunction ()=0
 
virtual void terminate ()
 
virtual void onThreadExit ()
 
virtual bool terminated ()
 
virtual void join ()
 
Id id () const
 
const Stringname () const
 
virtual bool sleep_for (std::chrono::milliseconds interval)
 
virtual bool sleep_until (const DateTime &timestamp)
 

Additional Inherited Members

- Public Types inherited from sptk::Thread
using Id = std::thread::id
 
- Static Public Member Functions inherited from sptk::LogEngine
static String priorityName (LogPriority prt)
 
static LogPriority priorityFromName (const String &prt)
 
- Protected Member Functions inherited from sptk::LogEngine
void threadFunction () override
 
void log (Logger::UMessage &message)
 
void shutdown () noexcept
 

Detailed Description

A log stored in the regular file.

A simplest possible way to implement logging. The log file is created automatically if it doesn't exist.

See also
CBaseLog for more information about basic log abilities.

Constructor & Destructor Documentation

◆ FileLogEngine()

sptk::FileLogEngine::FileLogEngine ( const fs::path &  fileName)
explicit

Constructor

Creates a new log object based on the file name. If this file doesn't exist - it will be created.

Parameters
fileNameLog file name

Member Function Documentation

◆ reset()

void sptk::FileLogEngine::reset ( )
overridevirtual

Restarts the log

The current log content is cleared. The file is recreated.

Reimplemented from sptk::LogEngine.

◆ saveMessage()

void sptk::FileLogEngine::saveMessage ( const Logger::UMessage &  message)
overridevirtual

Stores or sends log message to actual destination

Parameters
messageLog message

Implements sptk::LogEngine.


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

Fri Oct 14 2022 09:58:42: SPTK 5.4.1