Guardtime KSI c SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Enumerations | Functions
Logging

Enumerations

enum  KSI_LOG_LVL_en {
  KSI_LOG_NONE = 0x00, KSI_LOG_ERROR = 0x01, KSI_LOG_WARN = 0x02, KSI_LOG_NOTICE = 0x03,
  KSI_LOG_INFO = 0x04, KSI_LOG_DEBUG = 0x05
}
 

Functions

int KSI_LOG_debug (KSI_CTX *ctx, char *format,...) KSI_ATTRIBUTE((format(printf
 
int int KSI_LOG_info (KSI_CTX *ctx, char *format,...) KSI_ATTRIBUTE((format(printf
 
int int int KSI_LOG_notice (KSI_CTX *ctx, char *format,...) KSI_ATTRIBUTE((format(printf
 
int int int int KSI_LOG_warn (KSI_CTX *ctx, char *format,...) KSI_ATTRIBUTE((format(printf
 
int int int int int KSI_LOG_error (KSI_CTX *ctx, char *format,...) KSI_ATTRIBUTE((format(printf
 
int int int int int int KSI_LOG_logBlob (KSI_CTX *ctx, int level, const char *prefix_format, const unsigned char *data, size_t data_len,...) KSI_ATTRIBUTE((format(printf
 
int int int int int int int KSI_LOG_logTlv (KSI_CTX *ctx, int level, const char *prefix, const KSI_TLV *tlv)
 
int KSI_LOG_logDataHash (KSI_CTX *ctx, int level, const char *prefix, const KSI_DataHash *hsh)
 
int KSI_LOG_logCtxError (KSI_CTX *ctx, int level)
 
int KSI_LOG_StreamLogger (void *logCtx, int logLevel, const char *message)
 

Detailed Description

This group contains primitive functions for logging. There are 6 predefined log levels and one level for disabling logging.

Enumeration Type Documentation

Log level.

Enumerator
KSI_LOG_NONE 

Logging is turned off.

KSI_LOG_ERROR 

Error log level - unrecoverable fatal errors only - gasp of death - code cannot continue and will terminate.

KSI_LOG_WARN 

Warning log level - changes in state that affects the service degradation.

KSI_LOG_NOTICE 

Notice log level - changes in state that do not necessarily cause service degradation.

KSI_LOG_INFO 

Info log level - events that have no effect on service, but can aid in performance, status and statistics monitoring.

KSI_LOG_DEBUG 

Debug log level - events generated to aid in debugging, application flow and detailed service troubleshooting.

Function Documentation

int KSI_LOG_debug ( KSI_CTX ctx,
char *  format,
  ... 
)

Logging for debug level. Events generated to aid in debugging, application flow and detailed service troubleshooting.

Parameters
[in]ctxKSI context.
[in]formatFormat string.
[in]...Arguments.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int int int int int KSI_LOG_error ( KSI_CTX ctx,
char *  format,
  ... 
)

Logging for error level. Unrecoverable fatal errors only - gasp of death - code cannot continue and will terinate.

Parameters
[in]ctxKSI context.
[in]formatFormat string.
[in]...Arguments.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int int KSI_LOG_info ( KSI_CTX ctx,
char *  format,
  ... 
)

Logging for info level. Events that have no effect on service, but can aid in performance, status and statistics monitoring.

Parameters
[in]ctxKSI context.
[in]formatFormat string.
[in]...Arguments.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int int int int int int KSI_LOG_logBlob ( KSI_CTX ctx,
int  level,
const char *  prefix_format,
const unsigned char *  data,
size_t  data_len,
  ... 
)

A helper function for logging raw data. The log message will be prefixed with prefix_format and the binary data is logged as hex.

Parameters
[in]ctxKSI context.
[in]levelLog level.
[in]prefix_formatFormat string for the log prefix message.
[in]dataPointer to the raw data.
[in]data_lenLength of the data.
[in]...Arguments.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int KSI_LOG_logCtxError ( KSI_CTX ctx,
int  level 
)

A helper function for logging KSI context error trace.

Parameters
[in]ctxKSI context.
[in]levelLog level.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
See also
KSI_ERR_statusDump
int KSI_LOG_logDataHash ( KSI_CTX ctx,
int  level,
const char *  prefix,
const KSI_DataHash hsh 
)

A helper function for logging plain KSI_TLV objects. The log message will be prefixed with prefix and the TLV is logged as text on multiple lines (KSI_TLV_toString)

Parameters
[in]ctxKSI context.
[in]levelLog level.
[in]prefixPrefix for the log message.
[in]hshHash value to be logged.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
See also
KSI_TLV_toString
int int int int int int int KSI_LOG_logTlv ( KSI_CTX ctx,
int  level,
const char *  prefix,
const KSI_TLV tlv 
)

A helper function for logging plain KSI_TLV objects. The log message will be prefixed with prefix and the TLV is logged as text on multiple lines (KSI_TLV_toString)

Parameters
[in]ctxKSI context.
[in]levelLog level.
[in]prefixPrefix for the log message.
[in]tlvTLV to be logged.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
See also
KSI_TLV_toString
int int int KSI_LOG_notice ( KSI_CTX ctx,
char *  format,
  ... 
)

Logging for info level. Changes in state that do not necessarily cause service degradation.

Parameters
[in]ctxKSI context.
[in]formatFormat string.
[in]...Arguments.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
int KSI_LOG_StreamLogger ( void *  logCtx,
int  logLevel,
const char *  message 
)

The stream logger is a simple logging call-back to be used with KSI_CTX_setLoggerCallback. It will output the value to a FILE stream.

Parameters
[in]logCtxA stream to write the log messages.
[in]logLevelLog level.
[in]messageFormatted log message.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).
See also
KSI_CTX_setLoggerCallback, KSI_LoggerCallback
int int int int KSI_LOG_warn ( KSI_CTX ctx,
char *  format,
  ... 
)

Logging for warning level. Changes in state that affects the service degradation.

Parameters
[in]ctxKSI context.
[in]formatFormat string.
[in]...Arguments.
Returns
status code (KSI_OK, when operation succeeded, otherwise an error code).