File Targets

File targets send logs to a given file, a critical function for any logging library. File targets offer a simple and straightforward mechanic for writing logs, but note that you will still need a separate system for other functions like rotating them, encrypting them, or shipping them to another location.

The name of the target that is created will also be used as the filename. This should include any paths as well:

file_target = stumpless_open_file_target( "path/to/myfile.log",
                                          STUMPLESS_FACILITY_USER );

Of course logging to file targets is done as with any other:

stumpless_add_entry( file_target, entry );

Targets are closed in the usual way:

stumpless_close_file_target( file_target );

Or, using the generic (and slightly slower) function:

stumpless_close_target( file_target );