NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
|
A class to represent a single logging mechanism to a logging service on the network. More...
#include <be_io_syslogsheet.h>
Inherits BiometricEvaluation::IO::Logsheet.
Public Member Functions | |
SysLogsheet (const std::string &url, const std::string &description, const std::string &appname, bool sequenced, bool utc) | |
Create a new log sheet. More... | |
SysLogsheet (const std::string &url, const std::string &description, const std::string &appname, const std::string &hostname, bool sequenced, bool utc) | |
Create a new log sheet. More... | |
~SysLogsheet () | |
Destructor. More... | |
void | write (const std::string &entry) |
Write a string as an entry to the backing store. More... | |
void | writeComment (const std::string &entry) |
Write a string as a comment to the backing store. More... | |
void | writeDebug (const std::string &entry) |
Write a string as a debug entry to the backing store. More... | |
void | sync () |
Synchronize any buffered data to the underlying backing store. More... | |
![]() | |
Logsheet () | |
Create a Logsheet that has no backing store. More... | |
virtual | ~Logsheet () |
Destructor. More... | |
void | newEntry () |
Start a new entry, causing the existing entry to be closed and written. More... | |
std::string | getCurrentEntry () const |
Obtain the contents of the current entry currently under construction. More... | |
void | resetCurrentEntry () |
Reset the current entry buffer to the beginning. More... | |
uint32_t | getCurrentEntryNumber () const |
Obtain the current entry number. More... | |
virtual void | write (const std::string &entry) |
Write a string as an entry to the backing store. More... | |
virtual void | writeComment (const std::string &entry) |
Write a string as a comment to the backing store. More... | |
virtual void | writeDebug (const std::string &entry) |
Write a string as a debug entry to the backing store. More... | |
void | setCommit (const bool state) |
Enable or disable the commitment of normal entries to the backing log storage. More... | |
bool | getCommit () const |
Get the current entry commit state. More... | |
void | setDebugCommit (const bool state) |
Enable or disable the commitment of debug entries to the backing log storage. More... | |
bool | getDebugCommit () const |
Get the current debug entry commit state. More... | |
void | setCommentCommit (const bool state) |
Enable or disable the commitment of comment entries to the backing log storage. More... | |
bool | getCommentCommit () const |
Get the current comment entry commit state. More... | |
virtual void | sync () |
Synchronize any buffered data to the underlying backing store. More... | |
void | setAutoSync (bool state) |
Turn on/off auto-sync of the data. More... | |
bool | getAutoSync () const |
Return the current auto-sync state. More... | |
Protected Member Functions | |
SysLogsheet (const SysLogsheet &) | |
Prevent copying of SysLogsheet objects. More... | |
SysLogsheet & | operator= (const SysLogsheet &) |
Prevent copying of SysLogsheet objects. More... | |
void | setup (const std::string &url, const std::string &description) |
Helper function to build connections. More... | |
void | writeToLogger (const std::string &priority, const char delimiter, const std::string &prefix, const std::string &message) |
Helper function to write to the logger. More... | |
![]() | |
void | incrementEntryNumber () |
Increment the current entry number. More... | |
std::string | getCurrentEntryNumberAsString () const |
Obtain the current entry 'tag', in 'Edddd' format. More... | |
Protected Attributes | |
std::string | _hostname |
std::string | _appname |
std::string | _procid |
int | _sockFD |
Socket file descriptor for the logging system. More... | |
bool | _sequenced |
Whether to include entry sequence numbers. More... | |
bool | _operational |
Whether the sheet is operational. More... | |
bool | _utc |
Whether time stamps are in UTC. More... | |
Additional Inherited Members | |
![]() | |
enum class | Kind { Null , File , Syslog } |
![]() | |
static Logsheet::Kind | getTypeFromURL (const std::string &url) |
Map the URL scheme, taken from a string containing the entire URL, into a Logsheet type. More... | |
static bool | lineIsEntry (const std::string &line) |
Helper function to determine whether a string is a valid log entry. More... | |
static bool | lineIsComment (const std::string &line) |
Helper function to determine whether a string is a valid comment log entry. More... | |
static bool | lineIsDebug (const std::string &line) |
Helper function to determine whether a string is a valid debug log entry. More... | |
static std::string | trim (const std::string &entry) |
Trim delimiters from Logsheet entries. More... | |
![]() | |
static const char | CommentDelimiter = '#' |
Delimiter for a comment line in the log sheet. More... | |
static const char | EntryDelimiter = 'E' |
Delimiter for an entry line in the log sheet. More... | |
static const char | DebugDelimiter = 'D' |
Delimiter for an debug line in the log sheet. More... | |
static const std::string | DescriptionTag |
The tag for the description string. More... | |
static const std::string | FILEURLSCHEME |
The URL scheme to be used for FileLogsheet URL strings. More... | |
static const std::string | SYSLOGURLSCHEME |
The URL scheme to be used for SysLogsheet URL strings. More... | |
A class to represent a single logging mechanism to a logging service on the network.
Log entries are sent to the logging server in RFC5424 format with a timestamp of the local system in UTC. Normal and comment entries are sent to the logger with a PRI field indicating the 'local0' facility and a severity of 'Informational'. Debug entries are sent with facility of 'local1' and severity 'Debug'. A basic syslog config file would contain these lines: local0.info /var/log/info.log local1.debug /var/log/debug.log
The hostname is added to each entry but may be overridden by constructing the object with a given hostname, including the RFC5424 NILVALUE character. The PROCID part of each log message will be filled in with the process ID. Multi-line messages are segmented and sent the to logger as separate entries with the same timestamp and sequence number.
Definition at line 45 of file be_io_syslogsheet.h.
BiometricEvaluation::IO::SysLogsheet::SysLogsheet | ( | const std::string & | url, |
const std::string & | description, | ||
const std::string & | appname, | ||
bool | sequenced, | ||
bool | utc | ||
) |
Create a new log sheet.
[in] | url | The Uniform Resource Locator describing the logging service. Accepted forms are syslog://hostname:port |
[in] | description | The text used to describe the sheet. This text is written into the log prior to any entries. |
[in] | appname | The name of the application. This text is written into each log entry. |
[in] | sequenced | True if each entry should include a sequence number, false if not. |
[in] | utc | True if timestamps should be in Coordinated Universal Time (UTC), false for local time. |
Error::StrategyError | An error occurred when connecting to the logging system, or URL is malformed. |
BiometricEvaluation::IO::SysLogsheet::SysLogsheet | ( | const std::string & | url, |
const std::string & | description, | ||
const std::string & | appname, | ||
const std::string & | hostname, | ||
bool | sequenced, | ||
bool | utc | ||
) |
Create a new log sheet.
[in] | url | The Uniform Resource Locator describing the logging service. Accepted forms are syslog://hostname:port |
[in] | description | The text used to describe the sheet. This text is written into the log prior to any entries. |
[in] | appname | The name of the application. This text is written into each log entry. |
[in] | hostname | The string to use as the hostname for all log entries. |
[in] | sequenced | True if each entry should include a sequence number, false if not. |
[in] | utc | True if timestamps should be in Coordinated Universal Time (UTC), false for local time. |
Error::StrategyError | An error occurred when connecting to the logging system, or URL is malformed. |
BiometricEvaluation::IO::SysLogsheet::~SysLogsheet | ( | ) |
Destructor.
|
protected |
Prevent copying of SysLogsheet objects.
|
virtual |
Write a string as an entry to the backing store.
This does not affect the current log entry buffer, but does increment the entry number.
[in] | entry | The text of the log entry. |
Error::StrategyError | An error occurred when using the underlying backing store. |
Reimplemented from BiometricEvaluation::IO::Logsheet.
|
virtual |
Write a string as a comment to the backing store.
This does not affect the current log entry buffer, and does not increment the entry number. A comment line is prefixed with CommentDelimiter followed by a space by this method.
[in] | entry | The text of the comment. |
Error::StrategyError | An error occurred when using the underlying backing store. |
Reimplemented from BiometricEvaluation::IO::Logsheet.
|
virtual |
Write a string as a debug entry to the backing store.
This does not affect the current log entry buffer, and does not increment the entry number. A debug line is prefixed with DebugDelimiter followed by a space.
[in] | entry | The text of the debug message. |
Error::StrategyError | An error occurred when logging. |
Reimplemented from BiometricEvaluation::IO::Logsheet.
|
virtual |
Synchronize any buffered data to the underlying backing store.
This syncing is dependent on the behavior of the underlying storage mechanism.
Error::StrategyError | An error occurred when using the underlying backing store. |
Reimplemented from BiometricEvaluation::IO::Logsheet.
|
protected |
Prevent copying of SysLogsheet objects.
|
protected |
Helper function to build connections.
|
protected |
Helper function to write to the logger.
|
protected |
Definition at line 148 of file be_io_syslogsheet.h.
|
protected |
Definition at line 149 of file be_io_syslogsheet.h.
|
protected |
Definition at line 150 of file be_io_syslogsheet.h.
|
protected |
Socket file descriptor for the logging system.
Definition at line 153 of file be_io_syslogsheet.h.
|
protected |
Whether to include entry sequence numbers.
Definition at line 156 of file be_io_syslogsheet.h.
|
protected |
Whether the sheet is operational.
Definition at line 159 of file be_io_syslogsheet.h.
|
protected |
Whether time stamps are in UTC.
Definition at line 162 of file be_io_syslogsheet.h.