clibdocker  0.1.0-alpha.0
A Docker API for C
Macros | Typedefs | Enumerations | Functions
docker_log.h File Reference

Docker API logger for internal use mainly. It is based on rxi's log implementation with minor changes in function names. See License header. More...

#include <stdio.h>
#include <stdarg.h>
#include "docker_common.h"
Include dependency graph for docker_log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LOG_VERSION   "0.1.0"
 
#define docker_log_trace(...)   docker_log_log(LOG_TRACE, __FILE__, __LINE__, __VA_ARGS__)
 Trace log entry. More...
 
#define docker_log_debug(...)   docker_log_log(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__)
 Debug log entry. More...
 
#define docker_log_info(...)   docker_log_log(LOG_INFO, __FILE__, __LINE__, __VA_ARGS__)
 Info log entry. More...
 
#define docker_log_warn(...)   docker_log_log(LOG_WARN, __FILE__, __LINE__, __VA_ARGS__)
 Warning log entry. More...
 
#define docker_log_error(...)   docker_log_log(LOG_ERROR, __FILE__, __LINE__, __VA_ARGS__)
 Error log entry. More...
 
#define docker_log_fatal(...)   docker_log_log(LOG_FATAL, __FILE__, __LINE__, __VA_ARGS__)
 Fatal log entry. More...
 

Typedefs

typedef void(* log_LockFn) (void *udata, int lock)
 

Enumerations

enum  {
  LOG_TRACE , LOG_DEBUG , LOG_INFO , LOG_WARN ,
  LOG_ERROR , LOG_FATAL
}
 

Functions

void docker_log_set_udata (void *udata)
 Set the user data for the logger. More...
 
void docker_log_set_lock (log_LockFn fn)
 Set the lock function for the logger. More...
 
void docker_log_set_fp (FILE *fp)
 Set the file pointer for the logger. More...
 
void docker_log_set_level (int level)
 Enable the given log level. More...
 
void docker_log_set_quiet (int enable)
 Turn off the given log level. More...
 
void docker_log_log (int level, const char *file, int line, const char *fmt,...)
 Internal method for logging, called by all specific log level loggers. More...
 

Detailed Description

Docker API logger for internal use mainly. It is based on rxi's log implementation with minor changes in function names. See License header.

Copyright (c) 2017 rxi

This library is free software; you can redistribute it and/or modify it under the terms of the MIT license. See log.c for details.

Macro Definition Documentation

◆ docker_log_debug

#define docker_log_debug (   ...)    docker_log_log(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__)

Debug log entry.

Parameters
...data to log

◆ docker_log_error

#define docker_log_error (   ...)    docker_log_log(LOG_ERROR, __FILE__, __LINE__, __VA_ARGS__)

Error log entry.

Parameters
...data to log

◆ docker_log_fatal

#define docker_log_fatal (   ...)    docker_log_log(LOG_FATAL, __FILE__, __LINE__, __VA_ARGS__)

Fatal log entry.

Parameters
...data to log

◆ docker_log_info

#define docker_log_info (   ...)    docker_log_log(LOG_INFO, __FILE__, __LINE__, __VA_ARGS__)

Info log entry.

Parameters
...data to log

◆ docker_log_trace

#define docker_log_trace (   ...)    docker_log_log(LOG_TRACE, __FILE__, __LINE__, __VA_ARGS__)

Trace log entry.

Parameters
...data to log

◆ docker_log_warn

#define docker_log_warn (   ...)    docker_log_log(LOG_WARN, __FILE__, __LINE__, __VA_ARGS__)

Warning log entry.

Parameters
...data to log

◆ LOG_VERSION

#define LOG_VERSION   "0.1.0"

LOG API Version

Typedef Documentation

◆ log_LockFn

typedef void(* log_LockFn) (void *udata, int lock)

function type for a lock implementation to be used by the logger if locking is enabled

Function Documentation

◆ docker_log_log()

void docker_log_log ( int  level,
const char *  file,
int  line,
const char *  fmt,
  ... 
)

Internal method for logging, called by all specific log level loggers.

Parameters
levellog level
filefile pointer
lineline number
fmtformat string
...arguments to the logger

◆ docker_log_set_fp()

void docker_log_set_fp ( FILE *  fp)

Set the file pointer for the logger.

Parameters
fpfile pointer

◆ docker_log_set_level()

void docker_log_set_level ( int  level)

Enable the given log level.

Parameters
levellevel number (see log levels enum)

◆ docker_log_set_lock()

void docker_log_set_lock ( log_LockFn  fn)

Set the lock function for the logger.

Parameters
fnlock function

◆ docker_log_set_quiet()

void docker_log_set_quiet ( int  enable)

Turn off the given log level.

Parameters
enablelevel nubmer (see log levels enum)

◆ docker_log_set_udata()

void docker_log_set_udata ( void *  udata)

Set the user data for the logger.

Parameters
udatauserdata pointer