Derive-C
Loading...
Searching...
No Matches
trait.h File Reference

Go to the source code of this file.

Data Structures

struct  dc_log_location
struct  dc_log_id

Macros

#define DC_LOCATION   (dc_log_location) { __FILE__, __LINE__ }
#define DC_LOG_ID_LENGTH   32
#define DC_TRAIT_LOGGER(SELF)

Enumerations

enum  dc_log_level {
  DC_TRACE = 1 , DC_DEBUG , DC_INFO , DC_WARN ,
  DC_ERROR
}

Functions

static DC_PUBLIC char const * dc_log_level_to_string (dc_log_level level)

Macro Definition Documentation

◆ DC_LOCATION

#define DC_LOCATION   (dc_log_location) { __FILE__, __LINE__ }

Definition at line 34 of file trait.h.

34#define DC_LOCATION \
35 (dc_log_location) { __FILE__, __LINE__ }

◆ DC_LOG_ID_LENGTH

#define DC_LOG_ID_LENGTH   32

Definition at line 37 of file trait.h.

◆ DC_TRAIT_LOGGER

#define DC_TRAIT_LOGGER ( SELF)
Value:
DC_REQUIRE_TYPE(SELF, global_config); \
DC_REQUIRE_METHOD(SELF, SELF, new_global, (NS(SELF, global_config), dc_log_id id)); \
DC_REQUIRE_METHOD(SELF, SELF, from_parent, (SELF * parent, dc_log_id id)); \
DC_REQUIRE_METHOD(void, SELF, log, \
(SELF*, dc_log_location, dc_log_level, const char* const, ...)); \
DC_TRAIT_DELETABLE(SELF); \
DC_TRAIT_DEBUGABLE(SELF)
#define SELF
Definition def.h:52
#define NS(pre, post)
Definition namespace.h:14
#define DC_REQUIRE_TYPE(obj, name)
Definition require.h:23
dc_log_level
Definition trait.h:5

Definition at line 43 of file trait.h.

43#define DC_TRAIT_LOGGER(SELF) \
44 DC_REQUIRE_TYPE(SELF, global_config); \
45 DC_REQUIRE_METHOD(SELF, SELF, new_global, (NS(SELF, global_config), dc_log_id id)); \
46 DC_REQUIRE_METHOD(SELF, SELF, from_parent, (SELF * parent, dc_log_id id)); \
47 DC_REQUIRE_METHOD(void, SELF, log, \
48 (SELF*, dc_log_location, dc_log_level, const char* const, ...)); \
49 DC_TRAIT_DELETABLE(SELF); \
50 DC_TRAIT_DEBUGABLE(SELF)

Enumeration Type Documentation

◆ dc_log_level

Enumerator
DC_TRACE 
DC_DEBUG 
DC_INFO 
DC_WARN 
DC_ERROR 

Definition at line 5 of file trait.h.

5 {
6 DC_TRACE = 1,
#define DC_DEBUG(DEBUG_FN, DEBUG_PTR)
Definition dump.h:92
@ DC_INFO
Definition trait.h:8
@ DC_TRACE
Definition trait.h:6
@ DC_ERROR
Definition trait.h:10
@ DC_WARN
Definition trait.h:9

Function Documentation

◆ dc_log_level_to_string()

DC_PUBLIC char const * dc_log_level_to_string ( dc_log_level level)
static

Definition at line 13 of file trait.h.

13 {
14 switch (level) {
15 case DC_TRACE:
16 return "TRACE";
17 case DC_DEBUG:
18 return "DEBUG";
19 case DC_INFO:
20 return "INFO";
21 case DC_WARN:
22 return "WARN";
23 case DC_ERROR:
24 return "ERROR";
25 }
26 return "UNKNOWN";
27}