Demonstrates how to work with a chain target.
Demonstrates how to work with a chain target.
#include <stdio.h>
#include <stdlib.h>
int
main( void ){
char error_buffer[4096];
char message_buffer[4096];
size_t read_size;
& ~STUMPLESS_SEVERITY_MASK_UPTO( STUMPLESS_SEVERITY_ERR );
error_buffer,
sizeof( error_buffer ) );
printf( "\nerrors logged in memory:\n" );
do {
message_buffer,
sizeof( message_buffer ) );
printf( "%s\n", message_buffer );
} while( read_size > 1 );
return EXIT_SUCCESS;
}
#define stump_a(...)
Logs a message to the current target with alert severity.
Definition alert.h:97
STUMPLESS_PUBLIC_FUNCTION size_t stumpless_read_buffer(struct stumpless_target *target, char *buffer, size_t max_length)
Reads the next message from the provided buffer target and writes it into the given buffer.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_open_buffer_target(const char *name, char *buffer, size_t size)
Creates a buffer target for the given buffer.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_new_chain(const char *name)
Creates a new target chain.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_add_target_to_chain(struct stumpless_target *chain, struct stumpless_target *target)
Adds a target to an existing chain target.
STUMPLESS_PUBLIC_FUNCTION void stumpless_close_chain_and_contents(struct stumpless_target *chain)
Closes a chain of targets.
#define stump_c(...)
Logs a message to the current target with crit severity.
Definition crit.h:97
#define stump_d(...)
Logs a message to the current target with debug severity.
Definition debug.h:97
#define stump_em(...)
Logs a message to the current target with emerg severity.
Definition emerg.h:97
#define stump_er(...)
Logs a message to the current target with err severity.
Definition err.h:97
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_open_file_target(const char *name)
Opens a file target.
#define stump_i(...)
Logs a message to the current target with info severity.
Definition info.h:97
STUMPLESS_PUBLIC_FUNCTION void stumpless_free_all(void)
Closes the default target if it has been opened, frees all memory allocated internally,...
#define stump_n(...)
Logs a message to the current target with notice severity.
Definition notice.h:97
#define STUMPLESS_SEVERITY_MASK_UPTO(SEVERITY)
Creates a severity mask from EMERG up to the provided severity.
Definition severity.h:48
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_open_stdout_target(const char *name)
Opens a stream target for the stdout stream.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_open_stderr_target(const char *name)
Opens a stream target for the stderr stream.
A target that log entries can be sent to.
Definition target.h:140
int mask
The log mask for the target.
Definition target.h:181
The main header file for the stumpless logging library.
STUMPLESS_PUBLIC_FUNCTION struct stumpless_target * stumpless_set_target_mask(struct stumpless_target *target, int mask)
Sets the log mask of a target.
STUMPLESS_PUBLIC_FUNCTION int stumpless_add_message(struct stumpless_target *target, const char *message,...)
Adds a message to a given target.
#define stump_t(...)
Logs a message to the current target with debug severity, along with the file, line,...
Definition trace.h:106
#define stump_w(...)
Logs a message to the current target with warning severity.
Definition warning.h:97