LogName - Name of the log you're playing with.
BOOL Backup( LPCTSTR name_of_backup_file )
name_of_backup_file
.
BOOL Clear( LPCTSTR name_of_backup_file )
name_of_backup_file
. If name_of_backup_file
is NULL, no backup is made.
BOOL Close( void )
BOOL CreateApplicationLog( LPCTSTR application_name, LPCTSTR file_containing_message_table_resource, DWORD supported_types )
BOOL CreateCustomLog( LPCTSTR log_name, LPCTSTR log_filename = NULL, DWORD maximum_file_size = 0x800000, DWORD overwrite_after_this_many_seconds = 604800 )
maximum_file_size
specifies the maximum size of the event
log file. The overwrite_after_this_many_seconds
let's
you specify the age of an entry before it will be overwritten. The
default for these parameters is 8MB file size and 7 days before
events will be overwritten.
Delete( LPCTSTR log_name )
BOOL DeleteApplicationLog( LPCTSTR application_name )
BOOL DeregisterSource( void )
BOOL EnumerateLogs( DWORD& enumerator ) const
enumerator
so you can enumerate through
the logs that are installed on the system.
DWORD GetErrorCode( void ) const
HANDLE GetHandle( void ) const
BOOL GetNextLog( DWORD& enumerator, CString& log_name )
enumerator
must be initialized via the
EnumerateLogs() method.
Normally, when you enumerate the logs, you will get the
default three logs:
BOOL GetNumberOfRecords( DWORD& number_of_records )
DWORD GetOldestRecordNumber( void )
BOOL NotifyChange( HANDLE event_handle, HANDLE log_handle = NULL )
BOOL OpenBackup( LPCTSTR name_of_backup_file, LPCTSTR name_of_computer = NULL )
name_of_computer
is NULL, the local backup is openend.
BOOL Open( LPCTSTR log_name, LPCTSTR name_of_computer = NULL )
name_of_computer
is NULL, the local log is openend.
BOOL Read( DWORD record_number, LPVOID buffer, DWORD& number_of_bytes_to_read, DWORD how_to_read = EVENTLOG_FORWARDS_READ | EVENTLOG_SEQUENTIAL_READ ) BOOL Read( DWORD record_number, CEventLogRecord& record, DWORD how_to_read = EVENTLOG_FORWARDS_READ | EVENTLOG_SEQUENTIAL_READ )
BOOL RegisterSource( LPCTSTR source_name, LPCTSTR name_of_computer )
source_name
. If name_of_computer
is NULL, the local source is openend.
BOOL Report( EventType event_type, WORD category, DWORD event_id, WORD number_of_strings = 0, LPCTSTR * string_array = NULL, DWORD number_of_raw_bytes = 0, LPVOID raw_data_buffer = NULL, PSID user_sid = NULL )
event_type
parameter
may be one of the following:
BOOL ReportError( LPCTSTR string_to_report )
BOOL ReportInformation( LPCTSTR string_to_report )
#include <wfc.h>
void test_CEventLog( void )
{
WFCTRACEINIT( TEXT( "test_CEventLog()" ) );
CEventLog log( TEXT( "Dodah" ) );
LPCTSTR string_array[ 1 ];
string_array[ 0 ] = TEXT( "Hello World" );
log.Report( CEventLog::eventInformation, 0, 0, 1, string_array );
log.ReportInformation( TEXT( "ReportInformation" ) );
log.ReportError( TEXT( "ReportError" ) );
}