Concord - C Discord API library
A Discord API wrapper library written in C
log.h File Reference
#include <stdio.h>
#include <stdarg.h>
#include <stdbool.h>
#include <time.h>
Include dependency graph for log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  log_Event
 
struct  log_Callback
 
struct  log_Logger
 

Macros

#define LOG_VERSION   "x.x.x modified"
 
#define LOG_MAX_CALLBACKS   32
 
#define log_trace(...)   log_log(LOG_TRACE, __FILE__, __LINE__, __VA_ARGS__)
 
#define log_debug(...)   log_log(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__)
 
#define log_info(...)   log_log(LOG_INFO, __FILE__, __LINE__, __VA_ARGS__)
 
#define log_warn(...)   log_log(LOG_WARN, __FILE__, __LINE__, __VA_ARGS__)
 
#define log_error(...)   log_log(LOG_ERROR, __FILE__, __LINE__, __VA_ARGS__)
 
#define log_fatal(...)   log_log(LOG_FATAL, __FILE__, __LINE__, __VA_ARGS__)
 
#define log_set_lock(fn, udata)   _log_set_lock(&L, fn, udata);
 
#define log_set_level(level)   _log_set_level(&L, level);
 
#define log_set_quiet(enable)   _log_set_quiet(&L, enable)
 
#define log_add_callback(fn, udata, level)   _log_add_callback(&L, fn, udata, level)
 
#define log_add_fp(fn, level)   _log_add_fp(&L, fn, level)
 
#define log_log(level, file, line, ...)   _log_log(&L, level, file, line, __VA_ARGS__)
 

Typedefs

typedef void(* log_LogFn) (log_Event *ev)
 
typedef void(* log_LockFn) (bool lock, void *udata)
 

Enumerations

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

Functions

const char * log_level_string (int level)
 
void _log_set_lock (log_Logger *L, log_LockFn fn, void *udata)
 
void _log_set_level (log_Logger *L, int level)
 
void _log_set_quiet (log_Logger *L, bool enable)
 
int _log_add_callback (log_Logger *L, log_LogFn fn, void *udata, int level)
 
int _log_add_fp (log_Logger *L, FILE *fp, int level)
 
void _log_log (log_Logger *L, int level, const char *file, int line, const char *fmt,...)
 

Variables

const char * level_strings []
 
const char * level_colors []
 
log_Logger L
 

Macro Definition Documentation

◆ LOG_VERSION

#define LOG_VERSION   "x.x.x modified"

Copyright (c) 2020 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.

◆ log_trace

#define log_trace (   ...)    log_log(LOG_TRACE, __FILE__, __LINE__, __VA_ARGS__)

◆ log_debug

#define log_debug (   ...)    log_log(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__)

◆ log_info

#define log_info (   ...)    log_log(LOG_INFO, __FILE__, __LINE__, __VA_ARGS__)

◆ log_warn

#define log_warn (   ...)    log_log(LOG_WARN, __FILE__, __LINE__, __VA_ARGS__)
Examples
audit-log.c, and guild.c.

◆ log_error

#define log_error (   ...)    log_log(LOG_ERROR, __FILE__, __LINE__, __VA_ARGS__)

◆ log_fatal

#define log_fatal (   ...)    log_log(LOG_FATAL, __FILE__, __LINE__, __VA_ARGS__)

◆ log_set_lock

#define log_set_lock (   fn,
  udata 
)    _log_set_lock(&L, fn, udata);

◆ log_set_level

#define log_set_level (   level)    _log_set_level(&L, level);

◆ log_set_quiet

#define log_set_quiet (   enable)    _log_set_quiet(&L, enable)

◆ log_add_callback

#define log_add_callback (   fn,
  udata,
  level 
)    _log_add_callback(&L, fn, udata, level)

◆ log_add_fp

#define log_add_fp (   fn,
  level 
)    _log_add_fp(&L, fn, level)

◆ log_log

#define log_log (   level,
  file,
  line,
  ... 
)    _log_log(&L, level, file, line, __VA_ARGS__)

Function Documentation

◆ log_level_string()

const char * log_level_string ( int  level)

◆ _log_set_lock()

void _log_set_lock ( log_Logger L,
log_LockFn  fn,
void *  udata 
)

◆ _log_set_level()

void _log_set_level ( log_Logger L,
int  level 
)

◆ _log_set_quiet()

void _log_set_quiet ( log_Logger L,
bool  enable 
)

◆ _log_add_callback()

int _log_add_callback ( log_Logger L,
log_LogFn  fn,
void *  udata,
int  level 
)

◆ _log_add_fp()

int _log_add_fp ( log_Logger L,
FILE *  fp,
int  level 
)

◆ _log_log()

void _log_log ( log_Logger L,
int  level,
const char *  file,
int  line,
const char *  fmt,
  ... 
)

Variable Documentation

◆ level_strings

const char* level_strings[]
extern

◆ level_colors

const char* level_colors[]
extern

◆ L

log_Logger L
extern