C Server-Side SDK
LaunchDarkly SDK
logging.h File Reference

Public API Interface for Logging. More...

Include dependency graph for logging.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LD_LOG(level, text)   LDi_log(level, "[%s, %d] %s", __FILE__, __LINE__, text)
 A macro interface that allows convenient logging of line numbers.
 

Enumerations

enum  LDLogLevel { LD_LOG_FATAL = 0, LD_LOG_CRITICAL, LD_LOG_ERROR, LD_LOG_WARNING, LD_LOG_INFO, LD_LOG_DEBUG, LD_LOG_TRACE }
 The log levels compatible with the logging interface.
 

Functions

void LDi_log (const LDLogLevel level, const char *const format,...)
 Internal: Used for the non macro portion.
 
void LDBasicLogger (const LDLogLevel level, const char *const text)
 A provided logger that can be used as a convenient default. More...
 
void LDBasicLoggerThreadSafeInitialize (void)
 Setup routine for LDBasicLoggerThreadSafe. Call this before LDBasicLoggerThreadSafe is used.
 
void LDBasicLoggerThreadSafe (const LDLogLevel level, const char *const text)
 A provided logger that can be used as a convenient default. Must call LDBasicLoggerTSInitialize before use. This should be used instead of LDBasicLogger.
 
void LDBasicLoggerThreadSafeShutdown (void)
 Shutdown routine for LDBasicLoggerThreadSafe Call this when LDBasicLoggerThreadSafe is no longer used, after all LaunchDarkly resources are destroyed.
 
void LDConfigureGlobalLogger (const LDLogLevel level, void(*logger)(const LDLogLevel level, const char *const text))
 Set the logger, and the log level to use. This routine should only be used before any other LD routine. After any other routine has been used setting the logger is no longer a safe operation and may result in undefined behavior manifesting itself. More...
 
const char * LDLogLevelToString (const LDLogLevel level)
 Convert a verbosity level Enum value to an equivalent static string. This is intended as a convenience operation for building other loggers. More...
 

Detailed Description

Public API Interface for Logging.

Function Documentation

◆ LDBasicLogger()

void LDBasicLogger ( const LDLogLevel  level,
const char *const  text 
)

A provided logger that can be used as a convenient default.

Deprecated:
This is deprecated in favor of LDBasicLoggerThreadSafe.

◆ LDConfigureGlobalLogger()

void LDConfigureGlobalLogger ( const LDLogLevel  level,
void(*)(const LDLogLevel level, const char *const text)  logger 
)

Set the logger, and the log level to use. This routine should only be used before any other LD routine. After any other routine has been used setting the logger is no longer a safe operation and may result in undefined behavior manifesting itself.

Parameters
[in]levelThe verbosity of logs to send to logger.
[in]loggerThe new function to use for all future logging.
Returns
Void.

◆ LDLogLevelToString()

const char* LDLogLevelToString ( const LDLogLevel  level)

Convert a verbosity level Enum value to an equivalent static string. This is intended as a convenience operation for building other loggers.

Parameters
[in]levelThe log level to convert.
Returns
A static string on success, NULL on failure.