/usr/include/log4c/appender.h is in liblog4c-dev 1.2.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | /* $Id$
*
* appender.h
*
* Copyright 2001-2003, Meiosys (www.meiosys.com). All rights reserved.
*
* See the COPYING file for the terms of usage and distribution.
*/
#ifndef log4c_appender_h
#define log4c_appender_h
/**
* @file appender.h
*
* @brief Implement this interface for your own strategies for printing log
* statements.
*
* @todo the appender interface needs a better configuration system
* depending on the layout type. The udata field is a just a trick.
**/
#include <log4c/defs.h>
#include <log4c/layout.h>
#include <stdio.h>
__LOG4C_BEGIN_DECLS
struct __log4c_appender;
/**
* log4c appender class
**/
typedef struct __log4c_appender log4c_appender_t;
/**
* @brief log4c appender type class
*
* Attributes description:
*
* @li @c name appender type name
* @li @c open
* @li @c append
* @li @c close
**/
typedef struct log4c_appender_type {
const char* name;
int (*open) (log4c_appender_t*);
int (*append) (log4c_appender_t*, const log4c_logging_event_t*);
int (*close) (log4c_appender_t*);
} log4c_appender_type_t;
/**
* Get a pointer to an existing appender type.
*
* @param a_name the name of the appender type to return.
* @returns a pointer to an existing appender type, or NULL if no appender
* type with the specified name exists.
**/
LOG4C_API const log4c_appender_type_t* log4c_appender_type_get(const char* a_name);
/**
* Use this function to register an appender type with log4c.
* Once this is done you may refer to this type by name both
* programmatically and in the log4c
* configuration file.
*
* @param a_type a pointer to the new appender type to set.
* @returns a pointer to the previous appender type of same name.
*
* Example code fragment:
* @code
*
* const log4c_appender_type_t log4c_appender_type_s13_file = {
* "s13_file",
* s13_file_open,
* s13_file_append,
* s13_file_close,
* };
*
* log4c_appender_type_set(&log4c_appender_type_s13_file);
* @endcode
**/
LOG4C_API const log4c_appender_type_t* log4c_appender_type_set(
const log4c_appender_type_t* a_type);
/**
* Get a pointer to an existing appender.
*
* @param a_name the name of the appender to return.
* @returns a pointer to an existing appender, or NULL if no appender
* with the specfied name exists.
**/
LOG4C_API log4c_appender_t* log4c_appender_get(const char* a_name);
/**
* Constructor for log4c_appender_t.
**/
LOG4C_API log4c_appender_t* log4c_appender_new(const char* a_name);
/**
* Destructor for log4c_appender_t.
**/
LOG4C_API void log4c_appender_delete(log4c_appender_t* a_appender);
/**
* @param a_appender the log4c_appender_t object
* @return the appender name
**/
LOG4C_API const char* log4c_appender_get_name(const log4c_appender_t* a_appender);
/**
* @param a_appender the log4c_appender_t object
* @return the appender operations
**/
LOG4C_API const log4c_appender_type_t* log4c_appender_get_type(
const log4c_appender_t* a_appender);
/**
* @param a_appender the log4c_appender_t object
* @return the appender layout
**/
LOG4C_API const log4c_layout_t* log4c_appender_get_layout(
const log4c_appender_t* a_appender);
/**
* @param a_appender the log4c_appender_t object
* @return the appender user data
**/
LOG4C_API void* log4c_appender_get_udata(const log4c_appender_t* a_appender);
/**
* sets the appender type
*
* @param a_appender the log4c_appender_t object
* @param a_type the new appender type
* @return the previous appender type
**/
LOG4C_API const log4c_appender_type_t* log4c_appender_set_type(
log4c_appender_t* a_appender,
const log4c_appender_type_t* a_type);
/**
* sets the appender user data
*
* @param a_appender the log4c_appender_t object
* @param a_udata the new appender user data
* @return the previous appender user data
**/
LOG4C_API void* log4c_appender_set_udata(log4c_appender_t* a_appender,
void* a_udata);
/**
* sets the appender layout
*
* @param a_appender the log4c_appender_t object
* @param a_layout the new appender layout
* @return the previous appender layout
**/
LOG4C_API const log4c_layout_t* log4c_appender_set_layout(
log4c_appender_t* a_appender,
const log4c_layout_t* a_layout);
/**
* opens the appender.
*
* @param a_appender the log4c_appender_t object
**/
LOG4C_API int log4c_appender_open(log4c_appender_t* a_appender);
/**
* log in appender specific way.
*
* @param a_appender the log4c_appender object
* @param a_event the log4c_logging_event_t object to log.
**/
LOG4C_API int log4c_appender_append(
log4c_appender_t* a_appender,
log4c_logging_event_t* a_event);
/**
* closes the appender
*
* @param a_appender the log4c_appender_t object
* @return zero if successful, -1 otherwise
**/
LOG4C_API int log4c_appender_close(log4c_appender_t* a_appender);
/**
* prints the appender on a stream
*
* @param a_appender the log4c_appender_t object
* @param a_stream the stream
**/
LOG4C_API void log4c_appender_print(const log4c_appender_t* a_appender,
FILE* a_stream);
/**
* prints all the current registered appender types on a stream
*
* @param fp the stream
**/
LOG4C_API void log4c_appender_types_print(FILE *fp);
/**
* Helper macro to define static appender types.
*
* @param a_type the log4c_appender_type_t object to define
* @warning needs GCC support: otherwise this macro does nothing
* @deprecated This macro, and the static initialialization
* of appenders in general, is deprecated. Use rather
* the log4c_appender_type_set() function to initialize your appenders
* before calling log4c_init()
*
**/
#ifdef __GNUC__
# define log4c_appender_type_define(a_type) \
typedef int log4c_appender_type_define_##a_type __attribute__((deprecated)); \
static log4c_appender_type_define_##a_type __unsused_var __attribute__ ((unused));
#else
# define log4c_appender_type_define(a_type)
#endif
/**
* @internal
**/
struct __sd_factory;
LOG4C_API struct __sd_factory* log4c_appender_factory;
__LOG4C_END_DECLS
#endif
|