Demonstrates how to work with a Windows Event Log target.
Demonstrates how to work with a Windows Event Log target.
#include <stdlib.h>
#include <windows.h>
#include "docs/examples/wel/example_events.h"
int
main( int argc, char **argv ) {
DWORD register_result;
int log_result;
STUMPLESS_SEVERITY_INFO,
"tree-identifier-app",
"tree-identified-by-child",
"a child found a tree!" );
if( !basic_entry ) {
return EXIT_FAILURE;
}
if( register_result != ERROR_SUCCESS ) {
}
if( !wel_target ) {
return EXIT_FAILURE;
}
if( log_result < 0 ) {
return EXIT_FAILURE;
}
if( register_result != ERROR_SUCCESS ) {
}
if( !wel_target ) {
return EXIT_FAILURE;
}
if( !result ) {
return EXIT_FAILURE;
}
MSG_TREE_IDENTIFIED_BY_CHILD );
if( !result ) {
return EXIT_FAILURE;
}
if( !result ) {
return EXIT_FAILURE;
}
if( log_result < 0 ) {
return EXIT_FAILURE;
}
if( !result ) {
return EXIT_FAILURE;
}
if( !result ) {
return EXIT_FAILURE;
}
if( log_result < 0 ) {
return EXIT_FAILURE;
}
STUMPLESS_SEVERITY_INFO,
"tree-identifier-app",
"tree-identified-by-child",
"a child found a tree!" );
if( !entry_with_params ) {
return EXIT_FAILURE;
}
if( !result ) {
return EXIT_FAILURE;
}
MSG_TREE_IDENTIFIED_BY_CHILD );
if( !result ) {
return EXIT_FAILURE;
}
if( !result ) {
return EXIT_FAILURE;
}
if( !child_name ) {
return EXIT_FAILURE;
}
if( !result ) {
return EXIT_FAILURE;
}
if( !tree_type ) {
return EXIT_FAILURE;
}
if( !result ) {
return EXIT_FAILURE;
}
if( log_result < 0 ) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
STUMPLESS_PUBLIC_FUNCTION void stumpless_destroy_entry_and_contents(const struct stumpless_entry *entry)
Destroys an entry as well as all elements and params that it contains, freeing any allocated memory.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_entry * stumpless_new_entry(enum stumpless_facility facility, enum stumpless_severity severity, const char *app_name, const char *msgid, const char *message,...)
Creates a new entry with the given characteristics.
STUMPLESS_PUBLIC_FUNCTION void stumpless_perror(const char *prefix)
Prints information about the current error to the error stream.
STUMPLESS_PUBLIC_FUNCTION void stumpless_destroy_param(const struct stumpless_param *param)
Destroys a param, freeing any allocated memory.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_param * stumpless_new_param(const char *name, const char *value)
Creates a new param with the given name and value.
A log entry.
Definition entry.h:60
A parameter within a structured data element.
Definition param.h:93
A target that log entries can be sent to.
Definition target.h:140
The main header file for the stumpless logging library.
STUMPLESS_PUBLIC_FUNCTION int stumpless_add_entry(struct stumpless_target *target, const struct stumpless_entry *entry)
Adds an entry into a given target.
STUMPLESS_PUBLIC_FUNCTION void stumpless_close_wel_target(struct stumpless_target *target)
Closes a Windows Event Log target.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_open_local_wel_target(const char *name)
Opens a Windows Event Log target on the local machine.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_entry * stumpless_set_wel_category(struct stumpless_entry *entry, WORD category)
Sets the category of an entry for use with a Windows Event Log target.
STUMPLESS_PUBLIC_FUNCTION DWORD stumpless_add_default_wel_event_source(void)
Creates the registry entries for displaying default entries in the Windows Event Log.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_entry * stumpless_set_wel_event_id(struct stumpless_entry *entry, DWORD event_id)
Sets the event id of an entry for use with a Windows Event Log target.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_entry * stumpless_set_wel_insertion_string(struct stumpless_entry *entry, WORD index, LPCSTR str)
Sets a string to use for string insertion in a Windows Event Log entry.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_entry * stumpless_set_wel_type(struct stumpless_entry *entry, WORD type)
Sets the type of an entry for use with a Windows Event Log target.
STUMPLESS_PUBLIC_FUNCTION DWORD stumpless_remove_default_wel_event_source(void)
Removes the registry entries for the event source for default WEL entries.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_entry * stumpless_set_wel_insertion_param(struct stumpless_entry *entry, WORD index, const struct stumpless_param *param)
Sets a param to use for string insertion in a Windows Event Log entry.