DragonFly On-Line Manual Pages

Search: Section:  


LOGC_LOGGER(3)                   User Manuals                   LOGC_LOGGER(3)

NAME

logc_registerLogger, logc_removeLogger, logc_setLogFile, logc_setRingbuffer, logc_resetRingbuffer, logc_readRingbuffer, logc_changeLogLevel logc_setLogFormat - nglogc logger

SYNOPSIS

#include <nglogc/log.h> logc_error_t logc_registerLogger( uint16_t ident, logc_loggerType_t type, logc_logLevel_t level ); logc_error_t logc_removeLogger( uint16_t ident ); logc_error_t logc_setLogFile( uint16_t ident, const char* filename ); logc_error_t logc_setRingbuffer( uint16_t ident, const size_t size ); logc_error_t logc_resetRingbuffer( uint16_t ident ); logc_error_t logc_readRingbuffer( uint16_t ident, char* const buffer, const size_t size, size_t* const writtenBytes ); logc_error_t logc_changeLogLevel( uint16_t ident, logc_logLevel_t level ); logc_error_t logc_setLogFormat( uint16_t ident, logc_errRecordType_t errForm, logc_logRecordType_t logForm );

DESCRIPTION

The functions logc_registerLogger() and logc_removeLogger() are to register and remove a logger. Each nglogc log function needs a logger as argument which holds information about the log level, the publisher and the log format. A logger is stored internally and should be removed if it is not used any more. With the function logc_setLogFile() a file name must be set if the publisher is set to FILEOUT. logc_setRingbuffer is used to initialize the ringbuffer for RBUFOUT publisher. The ringbuffer is a kind of singleton and can be shared by other loggers. First call creates the ringbuffer, following calls are only to share the buffer to other loggers. logc_resetRingbuffer resets the content of the global ringbuffer. logc_readRingbuffer reads out the content of the global ringbuffer. For this and the above call it is independent which logger ID is used (but must be one which shares the buffer). The function logc_changeLogLevel() is used to change the log level at runtime. See section Loglevel for more information about the levels. The function logc_setLogFormat() is used to set the log format for log and error logging. The default is ERR for error messages and CLEAN for info messages. See section Logformat for more information about the format. Parameters ident Identifier of the logger which must be registered first. type Type of publisher, could be STDOUT, STDERROUT or FILEOUT. level The log level of the statement. Could be LOG_BASIC, LOG_WARNING, LOG_INFO, LOG_FINE or LOG_FINEST. filename File name for logging output. buffer Buffer to write data in. size Size of buffer. writtenBytes Number of bytes which were written to output buffer. errForm Format for error logging. Could be ERR, ERR_TAG, ERR_TAG_TIMESTAMP, ERR_TIMESTAMP_TAG, or TIMESTAMP_ERR_TAG. logForm Format for logging, is used for the log and logArray functions. Could be CLEAN or TIMESTAMP. Return value Upon successful return, these functions return LOG_ERR_OK which is an uint32_t type and has the decimal value 0. In error cases these errors can be returned: LOG_ERR_PARAM for invalid parameters. LOG_ERR_MEM no memory could be allocated for the logger. LOG_ERR_NOT_FOUND invalid logger ID. LOG_ERR_NULL filename is a NULL pointer. LOG_ERR_OPEN_FILE file could not be opened. LOG_ERR_WRONG_TYPE publisher type of logger is not valid for this function call. LOG_ERR_CREATE_RNGBUF ringbuffer creation failed. LOG_ERR_NO_ENTRIES ringbuffer has no content. LOG_ERR_INSUFFICIENT_BUFFER given buffer to small for ringbuffer content. More entries available. Loglevel Each logger has its own log level which is set by registering a logger or can be changed with the function logc_setLogLevel(). A log message will only be processed if the log message has the same or higher log level as the used logger. The type logc_logLevel_t is defined as an enumeration with the following levels in order of priority: LOG_BASIC severe log message LOG_WARNING warning log message LOG_INFO informal log message LOG_FINE debug log message LOG_FINEST detailed debug log message LOG_SILENT no logging LogFormat A logger has two different types of log formats, one for error logging and one for info logging. logc_errRecordType_t is used for error logging and is defined as an enumeration with the entries: ERR ERR : error message ERR_TAG ERR 0xYYYYYYYY : error message ERR_TAG_TIMESTAMP ERR 0xYYYYYYYY day mon dd hh:mm:ss YYYY : error message ERR_TIMESTAMP_TAG ERR day mon dd hh:mm:ss YYYY 0xYYYYYYYY : error message TIMESTAMP_ERR_TAG day mon dd hh:mm:ss YYYY ERR 0xYYYYYYYY : error message logc_logRecordType_t is used for info logging and is defined as an enumeration with the entries: CLEAN log message TIMESTAMP day mon dd hh:mm:ss YYYY : log message

BUG REPORT

For bugreporting write a mail to ebrosius@netgarage.org or use the issues tracker on the project hosting site http://code.google.com/p/nglogc

COPYRIGHT

nglogc is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

AUTHOR

Dennis Krzyzaniak <ebrosius@netgarage.org>

SEE ALSO

logc_logError(3), logc_logArray(3), logc_logEnter(3), logc_log(3) logc_defines(3), the project site http://netgarage.org Linux October 2009 LOGC_LOGGER(3)

Search: Section: