Public Types | |
enum | IncludeLines { NormalLogLines = 0x00, ExplicitLinesOnly = 0x01, AddHeaderToAllFiles = 0x00, AddHeaderToNewFiles = 0x10, ExplicitAndNew = ExplicitLinesOnly | AddHeaderToNewFiles } |
typedef unsigned long | DataLength |
enum | RotationPeriod { NoRotation, Hourly, Daily, Weekly } |
enum | FirstFileTimestamp { DoNotIncludeTimestampOnFirstFile, IncludeTimestampOnFirstFile } |
enum | EmptyLogFileHandling { PreserveEmptyLogFiles, DeleteEmptyLogFiles } |
enum | LogEntryFormat { JustMessage = 0x000, IncludeThreadId = 0x001, IncludeTimestamp = 0x010, IncludeEverything = 0x011 } |
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 | |
CFixedFileHeaderRotatingAsyncFileLog (const JetByteTools::Core::_tstring &filenameBase, RotationPeriod rotationPeriod=Daily, FirstFileTimestamp firstFileTimestamp=IncludeTimestampOnFirstFile, EmptyLogFileHandling emptyLogFileHandling=PreserveEmptyLogFiles, ILimitPendingWrites &writeLimiter=CPendingWriteLimiter::NoLimitLimiter) | |
See base class constructor for details. | |
CFixedFileHeaderRotatingAsyncFileLog (const JetByteTools::Core::_tstring &filenameBase, IHandleFileCreationFailure &handler, RotationPeriod rotationPeriod=Daily, FirstFileTimestamp firstFileTimestamp=IncludeTimestampOnFirstFile, EmptyLogFileHandling emptyLogFileHandling=PreserveEmptyLogFiles, ILimitPendingWrites &writeLimiter=CPendingWriteLimiter::NoLimitLimiter) | |
See base class constructor for details. | |
CFixedFileHeaderRotatingAsyncFileLog (const JetByteTools::Core::_tstring &filenameBase, JetByteTools::IO::IAllocateBuffers &allocator, IHandleFileCreationFailure &handler, RotationPeriod rotationPeriod=Daily, FirstFileTimestamp firstFileTimestamp=IncludeTimestampOnFirstFile, EmptyLogFileHandling emptyLogFileHandling=PreserveEmptyLogFiles, ILimitPendingWrites &writeLimiter=CPendingWriteLimiter::NoLimitLimiter) | |
See base class constructor for details. | |
CFixedFileHeaderRotatingAsyncFileLog (const JetByteTools::Core::_tstring &filenameBase, JetByteTools::Core::IQueueTimers &timerQueue, JetByteTools::IO::IIOPool &pool, JetByteTools::IO::IAllocateBuffers &allocator, RotationPeriod rotationPeriod=Daily, FirstFileTimestamp firstFileTimestamp=IncludeTimestampOnFirstFile, EmptyLogFileHandling emptyLogFileHandling=PreserveEmptyLogFiles, ILimitPendingWrites &writeLimiter=CPendingWriteLimiter::NoLimitLimiter) | |
See base class constructor for details. | |
CFixedFileHeaderRotatingAsyncFileLog (const JetByteTools::Core::_tstring &filenameBase, IHandleFileCreationFailure &handler, JetByteTools::Core::IQueueTimers &timerQueue, JetByteTools::IO::IIOPool &pool, JetByteTools::IO::IAllocateBuffers &allocator, RotationPeriod rotationPeriod=Daily, FirstFileTimestamp firstFileTimestamp=IncludeTimestampOnFirstFile, EmptyLogFileHandling emptyLogFileHandling=PreserveEmptyLogFiles, ILimitPendingWrites &writeLimiter=CPendingWriteLimiter::NoLimitLimiter) | |
See base class constructor for details. | |
CFixedFileHeaderRotatingAsyncFileLog (const JetByteTools::Core::_tstring &filenameBase, JetByteTools::Core::IQueueTimers &timerQueue, JetByteTools::IO::IIOPool &pool, JetByteTools::IO::IAllocateBuffers &allocator, const JetByteTools::Core::IProvideLocalTime &timeProvider, RotationPeriod rotationPeriod=Daily, FirstFileTimestamp firstFileTimestamp=IncludeTimestampOnFirstFile, EmptyLogFileHandling emptyLogFileHandling=PreserveEmptyLogFiles, ILimitPendingWrites &writeLimiter=CPendingWriteLimiter::NoLimitLimiter) | |
See base class constructor for details. | |
CFixedFileHeaderRotatingAsyncFileLog (const JetByteTools::Core::_tstring &filenameBase, IHandleFileCreationFailure &handler, JetByteTools::Core::IQueueTimers &timerQueue, JetByteTools::IO::IIOPool &pool, JetByteTools::IO::IAllocateBuffers &allocator, const JetByteTools::Core::IProvideLocalTime &timeProvider, RotationPeriod rotationPeriod=Daily, FirstFileTimestamp firstFileTimestamp=IncludeTimestampOnFirstFile, EmptyLogFileHandling emptyLogFileHandling=PreserveEmptyLogFiles, ILimitPendingWrites &writeLimiter=CPendingWriteLimiter::NoLimitLimiter) | |
See base class constructor for details. | |
CFixedFileHeaderRotatingAsyncFileLog (const CFixedFileHeaderRotatingAsyncFileLog &rhs) | |
~CFixedFileHeaderRotatingAsyncFileLog () override | |
CFixedFileHeaderRotatingAsyncFileLog & | operator= (const CFixedFileHeaderRotatingAsyncFileLog &rhs) |
void | SetLinesToInclude (IncludeLines includeLines) override |
void | LogFixedHeaderMessage (const std::string &message) override |
void | LogFixedHeaderMessage (const char *pString) override |
void | LogFixedHeaderMessage (const char *pString, ILogMessagesWithFixedFileHeader::DataLength stringLength) override |
void | FixedHeaderComplete () override |
void | LogMessage (const char *pString, ILogMessages::DataLength stringLength) override |
virtual void | LogFixedHeaderMessage (const char *pString, DataLength stringLength)=0 |
void | SetLogEntryFormat (DWORD format) |
void | SetMaxFileSize (__int64 size) |
void | SetMaxLines (size_t lines) |
void | SetNextFileNumber (DWORD nextFileNumber) |
void | SetCallback (CAsyncFileWriter::Callback *pCallback) |
Allows you to specify an optional callback implementation to receive notifications. | |
bool | PerformWritesOnThisThread () const |
Returns true if writes are issued directly from the calling thread and false if they are marshalled to the thread pool. | |
JetByteTools::Core::_tstring | GetCurrentLogFileName () const |
Returns the complete file name of the current log, i.e the filename that was set plus the date/time portion that is generated automatically. | |
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 &filenameBase) override |
Sets the name of the log file using the supplied filenameBase for the base of the log file name; the actual file name is formed as follows: filenameBase-YYYYMMDD-HHMMSS.log. If filenameBase ends with ".log" then this is automatically stripped to leave the actual file name in the form shown above. Note that if the file log was created with includeTimeInFirstFilename set to false then the file name will NOT include the -HHMMSS section. Note that this creates a new log file with the specified name, it does NOT rename the existing log file. All subsequent automatic log file creation will use the newly supplied filenameBase rather than any that was supplied in the constructor. | |
void | SetLogName (const std::wstring &filenameBase) override |
Sets the name of the log file using the supplied filenameBase for the base of the log file name; the actual file name is formed as follows: filenameBase-YYYYMMDD-HHMMSS.log. If filenameBase ends with ".log" then this is automatically stripped to leave the actual file name in the form shown above. Note that if the file log was created with includeTimeInFirstFilename set to false then the file name will NOT include the -HHMMSS section. Note that this creates a new log file with the specified name, it does NOT rename the existing log file. All subsequent automatic log file creation will use the newly supplied filenameBase rather than any that was supplied in the constructor. | |
void | LogMessage (const VectorOfLines &messages) override |
Logs the message to the log. | |
void | LogMessage (const DequeOfLines &messages) override |
Logs the message to the log. | |
void | LogMessage (const std::string &message) override |
Logs the message to the log. | |
void | LogMessage (const std::wstring &message) override |
Logs the message to the log. | |
void | LogMessage (const char *pString) override |
Logs the message to the log. | |
void | LogMessage (const wchar_t *pString) override |
Logs the message to the log. | |
void | LogMessage (const char *pString, DataLength stringLength) override |
Logs the message to the log. | |
void | LogMessage (const wchar_t *pString, DataLength stringLength) override |
Logs the message to the log. | |
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 |
Protected Member Functions | |
CAsyncFileWriterEx * | OnNewFileWriter (CAsyncFileWriterEx *pWriter) override |
CAsyncFileWriterEx & | GetFileWriter () |
typedef unsigned long DataLength [inherited] |
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.
enum IncludeLines [inherited] |
enum RotationPeriod [inherited] |
enum FirstFileTimestamp [inherited] |
enum EmptyLogFileHandling [inherited] |
enum LogEntryFormat [inherited] |
CFixedFileHeaderRotatingAsyncFileLog | ( | const JetByteTools::Core::_tstring & | filenameBase, | |
RotationPeriod | rotationPeriod = Daily , |
|||
FirstFileTimestamp | firstFileTimestamp = IncludeTimestampOnFirstFile , |
|||
EmptyLogFileHandling | emptyLogFileHandling = PreserveEmptyLogFiles , |
|||
ILimitPendingWrites & | writeLimiter = CPendingWriteLimiter::NoLimitLimiter | |||
) | [explicit] |
See base class constructor for details.
CFixedFileHeaderRotatingAsyncFileLog | ( | const JetByteTools::Core::_tstring & | filenameBase, | |
IHandleFileCreationFailure & | handler, | |||
RotationPeriod | rotationPeriod = Daily , |
|||
FirstFileTimestamp | firstFileTimestamp = IncludeTimestampOnFirstFile , |
|||
EmptyLogFileHandling | emptyLogFileHandling = PreserveEmptyLogFiles , |
|||
ILimitPendingWrites & | writeLimiter = CPendingWriteLimiter::NoLimitLimiter | |||
) |
See base class constructor for details.
CFixedFileHeaderRotatingAsyncFileLog | ( | const JetByteTools::Core::_tstring & | filenameBase, | |
JetByteTools::IO::IAllocateBuffers & | allocator, | |||
IHandleFileCreationFailure & | handler, | |||
RotationPeriod | rotationPeriod = Daily , |
|||
FirstFileTimestamp | firstFileTimestamp = IncludeTimestampOnFirstFile , |
|||
EmptyLogFileHandling | emptyLogFileHandling = PreserveEmptyLogFiles , |
|||
ILimitPendingWrites & | writeLimiter = CPendingWriteLimiter::NoLimitLimiter | |||
) |
See base class constructor for details.
CFixedFileHeaderRotatingAsyncFileLog | ( | const JetByteTools::Core::_tstring & | filenameBase, | |
JetByteTools::Core::IQueueTimers & | timerQueue, | |||
JetByteTools::IO::IIOPool & | pool, | |||
JetByteTools::IO::IAllocateBuffers & | allocator, | |||
RotationPeriod | rotationPeriod = Daily , |
|||
FirstFileTimestamp | firstFileTimestamp = IncludeTimestampOnFirstFile , |
|||
EmptyLogFileHandling | emptyLogFileHandling = PreserveEmptyLogFiles , |
|||
ILimitPendingWrites & | writeLimiter = CPendingWriteLimiter::NoLimitLimiter | |||
) |
See base class constructor for details.
CFixedFileHeaderRotatingAsyncFileLog | ( | const JetByteTools::Core::_tstring & | filenameBase, | |
IHandleFileCreationFailure & | handler, | |||
JetByteTools::Core::IQueueTimers & | timerQueue, | |||
JetByteTools::IO::IIOPool & | pool, | |||
JetByteTools::IO::IAllocateBuffers & | allocator, | |||
RotationPeriod | rotationPeriod = Daily , |
|||
FirstFileTimestamp | firstFileTimestamp = IncludeTimestampOnFirstFile , |
|||
EmptyLogFileHandling | emptyLogFileHandling = PreserveEmptyLogFiles , |
|||
ILimitPendingWrites & | writeLimiter = CPendingWriteLimiter::NoLimitLimiter | |||
) |
See base class constructor for details.
CFixedFileHeaderRotatingAsyncFileLog | ( | const JetByteTools::Core::_tstring & | filenameBase, | |
JetByteTools::Core::IQueueTimers & | timerQueue, | |||
JetByteTools::IO::IIOPool & | pool, | |||
JetByteTools::IO::IAllocateBuffers & | allocator, | |||
const JetByteTools::Core::IProvideLocalTime & | timeProvider, | |||
RotationPeriod | rotationPeriod = Daily , |
|||
FirstFileTimestamp | firstFileTimestamp = IncludeTimestampOnFirstFile , |
|||
EmptyLogFileHandling | emptyLogFileHandling = PreserveEmptyLogFiles , |
|||
ILimitPendingWrites & | writeLimiter = CPendingWriteLimiter::NoLimitLimiter | |||
) |
See base class constructor for details.
CFixedFileHeaderRotatingAsyncFileLog | ( | const JetByteTools::Core::_tstring & | filenameBase, | |
IHandleFileCreationFailure & | handler, | |||
JetByteTools::Core::IQueueTimers & | timerQueue, | |||
JetByteTools::IO::IIOPool & | pool, | |||
JetByteTools::IO::IAllocateBuffers & | allocator, | |||
const JetByteTools::Core::IProvideLocalTime & | timeProvider, | |||
RotationPeriod | rotationPeriod = Daily , |
|||
FirstFileTimestamp | firstFileTimestamp = IncludeTimestampOnFirstFile , |
|||
EmptyLogFileHandling | emptyLogFileHandling = PreserveEmptyLogFiles , |
|||
ILimitPendingWrites & | writeLimiter = CPendingWriteLimiter::NoLimitLimiter | |||
) |
See base class constructor for details.
~CFixedFileHeaderRotatingAsyncFileLog | ( | ) | [override] |
CFixedFileHeaderRotatingAsyncFileLog& operator= | ( | const CFixedFileHeaderRotatingAsyncFileLog & | rhs | ) |
void SetLinesToInclude | ( | IncludeLines | includeLines | ) | [override, virtual] |
Implements ILogMessagesWithFixedFileHeader.
void LogFixedHeaderMessage | ( | const std::string & | message | ) | [override, virtual] |
Implements ILogMessagesWithFixedFileHeader.
void LogFixedHeaderMessage | ( | const char * | pString | ) | [override, virtual] |
Implements ILogMessagesWithFixedFileHeader.
void LogFixedHeaderMessage | ( | const char * | pString, | |
ILogMessagesWithFixedFileHeader::DataLength | stringLength | |||
) | [override] |
void FixedHeaderComplete | ( | ) | [override, virtual] |
Implements ILogMessagesWithFixedFileHeader.
void LogMessage | ( | const char * | pString, | |
ILogMessages::DataLength | stringLength | |||
) | [override] |
CAsyncFileWriterEx * OnNewFileWriter | ( | CAsyncFileWriterEx * | pWriter | ) | [override, protected, virtual] |
Reimplemented from CRotatingAsyncFileLog.
virtual void LogFixedHeaderMessage | ( | const char * | pString, | |
DataLength | stringLength | |||
) | [pure virtual, inherited] |
void SetLogEntryFormat | ( | DWORD | format | ) | [inherited] |
void SetMaxFileSize | ( | __int64 | size | ) | [inherited] |
void SetMaxLines | ( | size_t | lines | ) | [inherited] |
void SetNextFileNumber | ( | DWORD | nextFileNumber | ) | [inherited] |
void SetCallback | ( | CAsyncFileWriter::Callback * | pCallback | ) | [inherited] |
Allows you to specify an optional callback implementation to receive notifications.
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.
_tstring GetCurrentLogFileName | ( | ) | const [inherited] |
Returns the complete file name of the current log, i.e the filename that was set plus the date/time portion that is generated automatically.
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 & | filenameBase | ) | [override, virtual, inherited] |
Sets the name of the log file using the supplied filenameBase for the base of the log file name; the actual file name is formed as follows: filenameBase-YYYYMMDD-HHMMSS.log. If filenameBase ends with ".log" then this is automatically stripped to leave the actual file name in the form shown above. Note that if the file log was created with includeTimeInFirstFilename set to false then the file name will NOT include the -HHMMSS section. Note that this creates a new log file with the specified name, it does NOT rename the existing log file. All subsequent automatic log file creation will use the newly supplied filenameBase rather than any that was supplied in the constructor.
Implements ILogMessages.
void SetLogName | ( | const std::wstring & | filenameBase | ) | [override, virtual, inherited] |
Sets the name of the log file using the supplied filenameBase for the base of the log file name; the actual file name is formed as follows: filenameBase-YYYYMMDD-HHMMSS.log. If filenameBase ends with ".log" then this is automatically stripped to leave the actual file name in the form shown above. Note that if the file log was created with includeTimeInFirstFilename set to false then the file name will NOT include the -HHMMSS section. Note that this creates a new log file with the specified name, it does NOT rename the existing log file. All subsequent automatic log file creation will use the newly supplied filenameBase rather than any that was supplied in the constructor.
Implements ILogMessages.
void LogMessage | ( | const VectorOfLines & | messages | ) | [override, virtual, inherited] |
void LogMessage | ( | const DequeOfLines & | messages | ) | [override, virtual, inherited] |
void LogMessage | ( | const std::string & | message | ) | [override, virtual, inherited] |
void LogMessage | ( | const std::wstring & | message | ) | [override, virtual, inherited] |
void LogMessage | ( | const char * | pString | ) | [override, virtual, inherited] |
void LogMessage | ( | const wchar_t * | pString | ) | [override, virtual, inherited] |
void LogMessage | ( | const char * | pString, | |
DataLength | stringLength | |||
) | [override, inherited] |
Logs the message to the log.
void LogMessage | ( | const wchar_t * | pString, | |
DataLength | stringLength | |||
) | [override, inherited] |
Logs the message to the log.
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] |
CAsyncFileWriterEx & GetFileWriter | ( | ) | [protected, inherited] |