<< Previous | Next >>

log_put

int log_put( LogFacPri ifp, uint8 fmt, const char *data, int length );

Description

Add a log entry. The specified facility/priority is mapped to the appropriate destination(s), as configured by the macros. If the destination exists, then the log entry is added; otherwise, the entry is quietly ignored. If a destination is unable to fit the log entry, and the destination is configured as "circular," then the first few entries may be deleted to make room. If this cannot be done, or an unrecoverable error occurs, then -2 is returned. For non-circular destinations, -2 is returned when it becomes full.

Since multiple log destinations can result from the given facility/priority, it can be difficult to determine which actual destination caused an error. You can use the log_map() function to determine the destinations, then check each destination's state using log_condition().

NOTE Please see the comments at the top of log.lib for a description of the message logging subsystem.

Parameters

ifp
Facility/priority code. Facility in 5 MSBs, priority in 3 LSBs.

fmt
Format code. 0 for ascii string, others user-defined.

data
Pointer to first byte of data to store.

length
Length of data. Must be between 0 and 115 (LOG_MAX_MESSAGE) inclusive.

Return Value

0 = success
-1 = Message too long (over 115).
-2 = Unrecoverable error in destination. This return code usually means that the destination is unusable and further entries for that destination will probably meet the same fate. This can also mean that the destination has not been opened.

Library

log.lib


Dynamic C Functions << Previous | Next >> rabbit.com