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

#include <SysLogEngine.h>

Inheritance diagram for sptk::SysLogEngine:
sptk::LogEngine sptk::Thread

Public Member Functions

void saveMessage (const Logger::UMessage &message) override
 
 SysLogEngine (const String &programName, uint32_t facilities=LOG_USER)
 
 ~SysLogEngine () override
 
void getOptions (uint32_t &options, String &programName, uint32_t &facilities) const
 
- 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 system log.

On *nix , the log is sent to *nix syslog daemon. On Windows NT/2000+/XP the log is sent to Event Log (Application). On Windows 95/98/ME the system log isn't supported.. The facility method allows to define - which system log is used

Constructor & Destructor Documentation

◆ SysLogEngine()

sptk::SysLogEngine::SysLogEngine ( const String programName,
uint32_t  facilities = LOG_USER 
)

Constructor

Creates a new log object based on the syslog facility (or facilities). For Windows, parameter facilities is ignored and messages are stored into Application event log. The program name is optional. It is set for all the SysLogEngine objects at once. If set, it appears in the log as a message prefix. Every time the program name is changed, the log is closed to be re-opened on next message.

Parameters
programNameProgram name
facilitiesLog facility or a set of facilities.

◆ ~SysLogEngine()

sptk::SysLogEngine::~SysLogEngine ( )
override

Destructor

Destructs the log object, closes the log descriptor, releases all the allocated resources

Member Function Documentation

◆ getOptions()

void sptk::SysLogEngine::getOptions ( uint32_t &  options,
String programName,
uint32_t &  facilities 
) const

Get log engine options

Parameters
optionsLog engine output options
programNameLog engine program name
facilitiesLog engine facilities

◆ saveMessage()

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

Stores or sends log message to actual destination

This method should be overwritten by the actual log implementation

Parameters
messageLog message

Implements sptk::LogEngine.


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

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