appender_type_stream.h File Reference

Log4c stream appender interface. More...

`#include <log4c/defs.h>`
`#include <log4c/appender.h>`

Go to the source code of this file.

## Variables

__LOG4C_BEGIN_DECLS const log4c_appender_type_t | log4c_appender_type_stream

## Detailed Description

Log4c stream appender interface.

The stream appender uses a file handle `FILE*` for logging. The appender's name is used as the file name which will be opened at first log. An appender can also be associated to an opened file handle using the log4c_appender_set_udata() method to update the appender user data field. In this last case, the appender name has no meaning. 2 default stream appenders are defined: `"stdout"` and `"stderr"`.

The following examples shows how to define and use stream appenders.

- the simple way
  log4c_appender_t* myappender;
  myappender = log4c_appender_get("myfile.log");
  log4c_appender_set_type(myappender, &log4c_appender_type_stream);

- the sophisticated way
  log4c_appender_t* myappender;
  myappender = log4c_appender_get("myappender");
  log4c_appender_set_type(myappender, &log4c_appender_type_stream);
  log4c_appender_set_udata(myappender, fopen("myfile.log", "w"));

## Variable Documentation

## log4c_appender_type_stream

__LOG4C_BEGIN_DECLS const log4c_appender_type_t log4c_appender_type_stream

Stream appender type definition.

This should be used as a parameter to the log4c_appender_set_type() routine to set the type of the appender.