|
Hybrid ICN (hICN) plugin
v21.06-rc0-4-g18fa668
|
Logger for the hicn-light forwarder. More...
#include <sys/time.h>#include <parc/algol/parc_Buffer.h>#include <parc/algol/parc_Clock.h>#include <parc/logging/parc_LogLevel.h>#include <parc/logging/parc_LogReporter.h>#include <stdarg.h>

Go to the source code of this file.
Typedefs | |
| typedef struct logger | Logger |
Enumerations | |
| enum | LoggerFacility { LoggerFacility_Config, LoggerFacility_Core, LoggerFacility_IO, LoggerFacility_Processor, LoggerFacility_Message, LoggerFacility_Strategy, LoggerFacility_END } |
Functions | |
| const char * | logger_FacilityString (LoggerFacility facility) |
| const char * | logger_LevelString (PARCLogLevel level) |
| Logger * | logger_Create (PARCLogReporter *reporter, const PARCClock *clock) |
| void | logger_Release (Logger **loggerPtr) |
| Logger * | logger_Acquire (const Logger *logger) |
| void | logger_SetLogLevel (Logger *logger, LoggerFacility facility, PARCLogLevel minimumLevel) |
| bool | logger_IsLoggable (const Logger *logger, LoggerFacility facility, PARCLogLevel level) |
| void | logger_Log (Logger *logger, LoggerFacility facility, PARCLogLevel level, const char *module, const char *format,...) |
| void | logger_SetReporter (Logger *logger, PARCLogReporter *reporter) |
| void | logger_SetClock (Logger *logger, PARCClock *clock) |
Logger for the hicn-light forwarder.
A facility based logger to allow selective logging from different parts of hicn-light
| enum LoggerFacility |
CONFIG faciilty concerns anything in the /config directory CORE concerns anything in the /core directory IO concerns anything in the /io directory (listeners, connectors, tcp, ethernet, etc.) PROCESSOR concerns FIB, PIT, CS MESSAGE concerns message events, like parsing
| Logger* logger_Acquire | ( | const Logger * | logger | ) |
Acquire logger
| Logger* logger_Create | ( | PARCLogReporter * | reporter, |
| const PARCClock * | clock | ||
| ) |
Create a logger that uses a given writer and clock
<#Paragraphs Of Explanation#>
| [in] | writer | The output writer |
| [in] | clock | The clock to use for log messages |
| non-null | An allocated logger |
| null | An error |
| const char* logger_FacilityString | ( | LoggerFacility | facility | ) |
Returns a string representation of a facility
Do not free the returned value.
| [in] | facility | The facility to change to a string |
| string | A string representation of the facility |
| bool logger_IsLoggable | ( | const Logger * | logger, |
| LoggerFacility | facility, | ||
| PARCLogLevel | level | ||
| ) |
Tests if the log level would be logged
If the facility would log the given level, returns true. May be used as a guard around expensive logging functions.
| [in] | logger | An allocated logger |
| [in] | facility | The facility to test |
| [in] | The | level to test |
| true | The given facility would log the given level |
| false | A message of the given level would not be logged |
| const char* logger_LevelString | ( | PARCLogLevel | level | ) |
Returns a string representation of a log level
Do not free the returned value.
| [in] | level | The level to change to a string |
| string | A string representation of the level |
| void logger_Log | ( | Logger * | logger, |
| LoggerFacility | facility, | ||
| PARCLogLevel | level, | ||
| const char * | module, | ||
| const char * | format, | ||
| ... | |||
| ) |
Log a message
The message will only be logged if it is loggable (logger_IsLoggable returns true).
| [in] | logger | An allocated Logger |
| [in] | facility | The facility to log under |
| [in] | level | The log level of the message |
| [in] | module | The specific module logging the message |
| [in] | format | The message with varargs |
| void logger_Release | ( | Logger ** | loggerPtr | ) |
Release logger
| void logger_SetClock | ( | Logger * | logger, |
| PARCClock * | clock | ||
| ) |
Set a new clock to use with the logger
The logger will start getting the time (logged as the messageid) from the specified clock
| [in] | logger | An allocated Logger |
| [in] | clock | An allocated PARCClock |
| void logger_SetLogLevel | ( | Logger * | logger, |
| LoggerFacility | facility, | ||
| PARCLogLevel | minimumLevel | ||
| ) |
Sets the minimum log level for a facility
The default log level is ERROR. For a message to be logged, it must be of equal or higher log level.
| [in] | logger | An allocated logger |
| [in] | facility | The facility to set the log level for |
| [in] | The | minimum level to log |
| void logger_SetReporter | ( | Logger * | logger, |
| PARCLogReporter * | reporter | ||
| ) |
Switch the logger to a new reporter
Will close the old reporter and re-setup the internal loggers to use the new reporter. All current log level settings are preserved.
| [in] | logger | An allocated Logger |
| [in] | reporter | An allocated PARCLogReporter |
1.8.17