Public Types | |
typedef unsigned long | DataLength |
typedef std::vector < std::string > | VectorOfLines |
Logs the messages to the log. Note that you should manually synchronise access to this function and the various SetLogName calls. | |
typedef std::deque < std::string > | DequeOfLines |
Logs the messages to the log. Note that you should manually synchronise access to this function and the various SetLogName calls. | |
Public Member Functions | |
CAsyncFileLog (const JetByteTools::Core::_tstring &filename, JetByteTools::IO::ILimitPendingWrites &writeLimiter=JetByteTools::IO::CPendingWriteLimiter::NoLimitLimiter) | |
Construct an async file log using the supplied filename for the log file. File I/O will be done using a default I/O thread pool with a single thread and buffers will be allocated from a default allocator with a buffer size of 100 bytes and a pool size of 10. If a maxPendingWrites limit is supplied then this is used to limit the maximum number of pending writes to prevent uncontrolled 'non paged pool' memory usage if log messages are produced at a rate faster than they can be written to the disk. Note that once the limit is reached all writes become synchronous until the number of pending writes has dropped below the limit again. | |
CAsyncFileLog (const JetByteTools::Core::_tstring &filename, JetByteTools::IO::IIOPool &pool, JetByteTools::IO::IAllocateBuffers &allocator, JetByteTools::IO::ILimitPendingWrites &writeLimiter=JetByteTools::IO::CPendingWriteLimiter::NoLimitLimiter) | |
Construct an async file log using the supplied filename for the log file. File I/O will be done using the threads in the IIOPool provided and data buffers obtained from the supplied buffer allocator. If a maxPendingWrites limit is supplied then this is used to limit the maximum number of pending writes to prevent uncontrolled 'non paged pool' memory usage if log messages are produced at a rate faster than they can be written to the disk. Note that once the limit is reached all writes become synchronous until the number of pending writes has dropped below the limit again. | |
CAsyncFileLog (const JetByteTools::Core::_tstring &filename, JetByteTools::IO::IIOPool &pool, JetByteTools::IO::IAllocateBuffers &allocator, const JetByteTools::Core::IProvideLocalTime &timeProvider, JetByteTools::IO::ILimitPendingWrites &writeLimiter=JetByteTools::IO::CPendingWriteLimiter::NoLimitLimiter) | |
Construct an async file log using the supplied filename for the log file. File I/O will be done using the threads in the IIOPool provided and data buffers obtained from the supplied buffer allocator. If a maxPendingWrites limit is supplied then this is used to limit the maximum number of pending writes to prevent uncontrolled 'non paged pool' memory usage if log messages are produced at a rate faster than they can be written to the disk. Note that once the limit is reached all writes become synchronous until the number of pending writes has dropped below the limit again. | |
CAsyncFileLog (const CAsyncFileLog &rhs) | |
CAsyncFileLog & | operator= (const CAsyncFileLog &rhs) |
void | SetShutdownHandler (CSimpleServerShutdownHandler &shutdownHandler) |
void | SetShutdownEvent (JetByteTools::Core::CManualResetEvent &event) |
bool | PerformWritesOnThisThread () const |
Returns true if writes are issued directly from the calling thread and false if they are marshalled to the thread pool. | |
void | SetThreadIdentifier (const std::string &identifier) override |
Sets the identifier used in the log for the current thread to the supplied string. The thread identifier defaults to the thread id in the form "XXX: ", the string supplied as an identifier does not need to include the ": " as this will be appended automatically. It can be any string that will help you to identify the thread concerned. | |
void | SetThreadIdentifier (const std::wstring &identifier) override |
Sets the identifier used in the log for the current thread to the supplied string. The thread identifier defaults to the thread id in the form "XXX: ", the string supplied as an identifier does not need to include the ": " as this will be appended automatically. It can be any string that will help you to identify the thread concerned. | |
void | SetLogName (const std::string &filename) override |
Sets the name of the log file to the supplied name. Note that this creates a new log file with the specified name, it does NOT rename the existing log file. Note that you should manually synchronise access to this function and the various LogMessage and IWaitable calls. | |
void | SetLogName (const std::wstring &filename) override |
Sets the name of the log file to the supplied name. Note that this creates a new log file with the specified name, it does NOT rename the existing log file. Note that you should manually synchronise access to this function and the various LogMessage and IWaitable calls. | |
void | LogMessage (const VectorOfLines &messages) override |
void | LogMessage (const DequeOfLines &messages) override |
void | LogMessage (const std::string &message) override |
Logs the message to the log. Note that you should manually synchronise access to this function and the various SetLogName calls. | |
void | LogMessage (const std::wstring &message) override |
Logs the message to the log. Note that you should manually synchronise access to this function and the various SetLogName calls. | |
void | LogMessage (const char *pString) override |
Logs the message to the log. Note that you should manually synchronise access to this function and the various SetLogName calls. | |
void | LogMessage (const wchar_t *pString) override |
Logs the message to the log. Note that you should manually synchronise access to this function and the various SetLogName calls. | |
void | LogMessage (const char *pString, DataLength stringLength) override |
void | LogMessage (const wchar_t *pString, DataLength stringLength) override |
virtual void | LogMessage (const char *pString, DataLength stringLength)=0 |
Logs the message to the log. Note that you should manually synchronise access to this function and the various SetLogName calls. | |
virtual void | LogMessage (const wchar_t *pString, DataLength stringLength)=0 |
Logs the message to the log. Note that you should manually synchronise access to this function and the various SetLogName calls. | |
HANDLE | GetWaitHandle () const override |
void | Wait () const override |
bool | Wait (Milliseconds timeoutMillis) const override |
typedef unsigned long DataLength [inherited] |
typedef std::vector<std::string> VectorOfLines [inherited] |
Logs the messages to the log. Note that you should manually synchronise access to this function and the various SetLogName calls.
typedef std::deque<std::string> DequeOfLines [inherited] |
Logs the messages to the log. Note that you should manually synchronise access to this function and the various SetLogName calls.
CAsyncFileLog | ( | const JetByteTools::Core::_tstring & | filename, | |
JetByteTools::IO::ILimitPendingWrites & | writeLimiter = JetByteTools::IO::CPendingWriteLimiter::NoLimitLimiter | |||
) | [explicit] |
Construct an async file log using the supplied filename for the log file. File I/O will be done using a default I/O thread pool with a single thread and buffers will be allocated from a default allocator with a buffer size of 100 bytes and a pool size of 10. If a maxPendingWrites limit is supplied then this is used to limit the maximum number of pending writes to prevent uncontrolled 'non paged pool' memory usage if log messages are produced at a rate faster than they can be written to the disk. Note that once the limit is reached all writes become synchronous until the number of pending writes has dropped below the limit again.
Reimplemented from CAsyncFileLog.
CAsyncFileLog | ( | const JetByteTools::Core::_tstring & | filename, | |
JetByteTools::IO::IIOPool & | pool, | |||
JetByteTools::IO::IAllocateBuffers & | allocator, | |||
JetByteTools::IO::ILimitPendingWrites & | writeLimiter = JetByteTools::IO::CPendingWriteLimiter::NoLimitLimiter | |||
) |
Construct an async file log using the supplied filename for the log file. File I/O will be done using the threads in the IIOPool provided and data buffers obtained from the supplied buffer allocator. If a maxPendingWrites limit is supplied then this is used to limit the maximum number of pending writes to prevent uncontrolled 'non paged pool' memory usage if log messages are produced at a rate faster than they can be written to the disk. Note that once the limit is reached all writes become synchronous until the number of pending writes has dropped below the limit again.
Reimplemented from CAsyncFileLog.
CAsyncFileLog | ( | const JetByteTools::Core::_tstring & | filename, | |
JetByteTools::IO::IIOPool & | pool, | |||
JetByteTools::IO::IAllocateBuffers & | allocator, | |||
const JetByteTools::Core::IProvideLocalTime & | timeProvider, | |||
JetByteTools::IO::ILimitPendingWrites & | writeLimiter = JetByteTools::IO::CPendingWriteLimiter::NoLimitLimiter | |||
) |
Construct an async file log using the supplied filename for the log file. File I/O will be done using the threads in the IIOPool provided and data buffers obtained from the supplied buffer allocator. If a maxPendingWrites limit is supplied then this is used to limit the maximum number of pending writes to prevent uncontrolled 'non paged pool' memory usage if log messages are produced at a rate faster than they can be written to the disk. Note that once the limit is reached all writes become synchronous until the number of pending writes has dropped below the limit again.
Reimplemented from CAsyncFileLog.
CAsyncFileLog | ( | const CAsyncFileLog & | rhs | ) |
CAsyncFileLog& operator= | ( | const CAsyncFileLog & | rhs | ) |
void SetShutdownHandler | ( | CSimpleServerShutdownHandler & | shutdownHandler | ) |
void SetShutdownEvent | ( | JetByteTools::Core::CManualResetEvent & | event | ) |
bool PerformWritesOnThisThread | ( | ) | const [inherited] |
Returns true if writes are issued directly from the calling thread and false if they are marshalled to the thread pool.
void SetThreadIdentifier | ( | const std::string & | identifier | ) | [override, virtual, inherited] |
Sets the identifier used in the log for the current thread to the supplied string. The thread identifier defaults to the thread id in the form "XXX: ", the string supplied as an identifier does not need to include the ": " as this will be appended automatically. It can be any string that will help you to identify the thread concerned.
Implements ILogMessages.
void SetThreadIdentifier | ( | const std::wstring & | identifier | ) | [override, virtual, inherited] |
Sets the identifier used in the log for the current thread to the supplied string. The thread identifier defaults to the thread id in the form "XXX: ", the string supplied as an identifier does not need to include the ": " as this will be appended automatically. It can be any string that will help you to identify the thread concerned.
Implements ILogMessages.
void SetLogName | ( | const std::string & | name | ) | [override, virtual, inherited] |
Sets the name of the log file to the supplied name. Note that this creates a new log file with the specified name, it does NOT rename the existing log file. Note that you should manually synchronise access to this function and the various LogMessage and IWaitable calls.
Implements ILogMessages.
void SetLogName | ( | const std::wstring & | name | ) | [override, virtual, inherited] |
Sets the name of the log file to the supplied name. Note that this creates a new log file with the specified name, it does NOT rename the existing log file. Note that you should manually synchronise access to this function and the various LogMessage and IWaitable calls.
Implements ILogMessages.
void LogMessage | ( | const VectorOfLines & | messages | ) | [override, virtual, inherited] |
Implements ILogMessages.
void LogMessage | ( | const DequeOfLines & | messages | ) | [override, virtual, inherited] |
Implements ILogMessages.
void LogMessage | ( | const std::string & | message | ) | [override, virtual, inherited] |
Logs the message to the log. Note that you should manually synchronise access to this function and the various SetLogName calls.
Implements ILogMessages.
void LogMessage | ( | const std::wstring & | message | ) | [override, virtual, inherited] |
Logs the message to the log. Note that you should manually synchronise access to this function and the various SetLogName calls.
Implements ILogMessages.
void LogMessage | ( | const char * | pString | ) | [override, virtual, inherited] |
Logs the message to the log. Note that you should manually synchronise access to this function and the various SetLogName calls.
Implements ILogMessages.
void LogMessage | ( | const wchar_t * | pString | ) | [override, virtual, inherited] |
Logs the message to the log. Note that you should manually synchronise access to this function and the various SetLogName calls.
Implements ILogMessages.
void LogMessage | ( | const char * | pString, | |
DataLength | stringLength | |||
) | [override, inherited] |
void LogMessage | ( | const wchar_t * | pString, | |
DataLength | stringLength | |||
) | [override, inherited] |
virtual void LogMessage | ( | const char * | pString, | |
DataLength | stringLength | |||
) | [pure virtual, inherited] |
Logs the message to the log. Note that you should manually synchronise access to this function and the various SetLogName calls.
virtual void LogMessage | ( | const wchar_t * | pString, | |
DataLength | stringLength | |||
) | [pure virtual, inherited] |
Logs the message to the log. Note that you should manually synchronise access to this function and the various SetLogName calls.
HANDLE GetWaitHandle | ( | ) | const [override, inherited] |
void Wait | ( | ) | const [override, inherited] |
bool Wait | ( | Milliseconds | timeoutMillis | ) | const [override, inherited] |