stumpless 2.2.0
Loading...
Searching...
No Matches
BufferTarget.hpp
Go to the documentation of this file.
1#ifndef __BUFFERTARGET_HPP
2#define __BUFFERTARGET_HPP
3
4#include <stumpless/target.h>
5#include <stddef.h>
6#include <stumpless/Entry.hpp>
7
8namespace stumpless {
9
18 public:
19
20 struct stumpless_target *equivalent;
21
22 BufferTarget( struct stumpless_target *equivalent );
32 BufferTarget( const char *name, char *buffer, size_t size );
58 size_t Read( char *buffer, size_t max_length );
66 const char *GetDefaultAppName( void );
74 const char *GetDefaultMsgid( void );
89 stumpless_filter_func_t GetFilter( void );
99 int GetMask( void );
107 const char *GetName( void );
118 int GetOption( int option );
124 bool IsOpen( void );
138 BufferTarget& Log( const char *message, ... );
155 BufferTarget& Log( int priority, const char *message, ... );
172 BufferTarget& Log( Facility facility, Severity severity, const char *message, ... );
184 void Open( void );
192 BufferTarget& SetDefaultAppName( const char *app_name );
209 BufferTarget& SetDefaultMsgid( const char *msgid );
218 BufferTarget& SetFilter( stumpless_filter_func_t filter );
230 BufferTarget& SetMask( int mask );
238 BufferTarget& SetOption( int option );
247 BufferTarget& UnsetOption( int option );
248 };
249
250}
251
252#endif
A target that will write log messages to a provided buffer, wrapping around when the end is reached.
Definition BufferTarget.hpp:17
BufferTarget & Log(int priority, const char *message,...)
Writes a log message with the given priority to this target.
~BufferTarget(void)
Closes the target and releases all memory owned by it.
BufferTarget & SetDefaultAppName(const char *app_name)
Sets the default app name for this target.
struct stumpless_target * equivalent
Definition BufferTarget.hpp:20
const char * GetName(void)
Returns the name of this target.
size_t Read(char *buffer, size_t max_length)
Reads the next message from this target and writes it into the given buffer.
BufferTarget & SetDefaultFacility(int facility)
Sets the default facility of the target.
BufferTarget(struct stumpless_target *equivalent)
int GetMask(void)
Gets the log mask of this target.
BufferTarget & UnsetOption(int option)
Unsets an option on a target.
BufferTarget(const char *name, char *buffer, size_t size)
Opens a buffer target for the given buffer.
BufferTarget & SetDefaultMsgid(const char *msgid)
Sets the default message id for this target.
const char * GetDefaultAppName(void)
Returns the default app name used by this target.
const char * GetDefaultMsgid(void)
Returns the default msgid used by this target.
int GetOption(int option)
Gets the given option for this target.
BufferTarget & Log(const char *message,...)
Writes a string message to this target.
bool IsOpen(void)
Checks to see if this target is open.
BufferTarget & Log(Entry entry)
Writes an Entry to this target.
stumpless_filter_func_t GetFilter(void)
Returns the current filter used by this target to determine if entries should be allowed through it.
BufferTarget & SetFilter(stumpless_filter_func_t filter)
Sets the filter used by this target to determine whether entries should be logged to it.
BufferTarget & SetOption(int option)
Sets an option on a target.
Facility GetDefaultFacility(void)
Gets the default facility of this target.
BufferTarget & Log(Facility facility, Severity severity, const char *message,...)
Writes a log message with the given facility and severity to this target.
void Open(void)
Opens this target if it has been paused.
BufferTarget & SetMask(int mask)
Sets the log mask of a target.
A log entry.
Definition Entry.hpp:19
Definition AddressFailure.hpp:7
Facility
Facilities (as defined in RFC 5424) describe the general classification of an event.
Definition Facility.hpp:17
Severity
Severities (as defined in RFC 5424) describe the level of importance of a given log entry.
Definition Severity.hpp:15