Objectively 1.0.0
Ultra-lightweight object oriented framework for GNU C.
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Enumerations | Functions
Log.h File Reference

A Log4J-inspired log appender. More...

#include <stdio.h>
#include <Objectively/Object.h>

Go to the source code of this file.

Data Structures

struct  Log
 A Log4J-inspired log appender. More...
 

Macros

#define LOG_FORMAT_DEFAULT   "%c %%n [%%l]: %%m"
 The default Log format. More...
 

Enumerations

enum  LogLevel {
  LogLevelTrace , LogLevelDebug , LogLevelInfo , LogLevelWarn ,
  LogLevelError , LogLevelFatal
}
 Every Log has a threshold for generating messages. More...
 

Functions

OBJECTIVELY_EXPORT Class_Log (void)
 

Detailed Description

A Log4J-inspired log appender.

Definition in file Log.h.

Macro Definition Documentation

◆ LOG_FORMAT_DEFAULT

#define LOG_FORMAT_DEFAULT   "%c %%n [%%l]: %%m"

The default Log format.

Definition at line 52 of file Log.h.

Enumeration Type Documentation

◆ LogLevel

enum LogLevel

Every Log has a threshold for generating messages.

Messages beneath the set threshold level are not output. The default level for newly initialized Logs is LogLevelInfo.

Enumerator
LogLevelTrace 
LogLevelDebug 
LogLevelInfo 
LogLevelWarn 
LogLevelError 
LogLevelFatal 

Definition at line 40 of file Log.h.

40 {
47} LogLevel;
LogLevel
Every Log has a threshold for generating messages.
Definition: Log.h:40
@ LogLevelFatal
Definition: Log.h:46
@ LogLevelError
Definition: Log.h:45
@ LogLevelTrace
Definition: Log.h:41
@ LogLevelWarn
Definition: Log.h:44
@ LogLevelDebug
Definition: Log.h:42
@ LogLevelInfo
Definition: Log.h:43

Function Documentation

◆ _Log()

OBJECTIVELY_EXPORT Class * _Log ( void  )

Definition at line 285 of file Log.c.

285 {
286 static Class *clazz;
287 static Once once;
288
289 do_once(&once, {
290 clazz = _initialize(&(const ClassDef) {
291 .name = "Log",
292 .superclass = _Object(),
293 .instanceSize = sizeof(Log),
294 .interfaceOffset = offsetof(Log, interface),
295 .interfaceSize = sizeof(LogInterface),
297 .destroy = destroy,
298 });
299 });
300
301 return clazz;
302}
Class * _initialize(const ClassDef *def)
Initializes the given Class.
Definition: Class.c:91
static void destroy(Class *clazz)
Definition: Log.c:276
static void initialize(Class *clazz)
Definition: Log.c:256
long Once
The Once type.
Definition: Once.h:37
#define do_once(once, block)
Executes the given block at most one time.
Definition: Once.h:43
ClassDefs are passed to _initialize via an archetype to initialize a Class.
Definition: Class.h:41
The runtime representation of a Class.
Definition: Class.h:95
A Log4J-inspired log appender.
Definition: Log.h:61
Class * _Object(void)
The Object archetype.
Definition: Object.c:136