taskrambler  0.1.9
Web server and task management solution.
logger/interface/logger.h File Reference
#include <stdarg.h>
#include "class.h"
#include "logger.h"
+ Include dependency graph for logger/interface/logger.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  i_Logger
 

Typedefs

typedef void(* fptr_log) (void *, logger_level, const char *const)
 

Functions

void loggerLog (void *, logger_level, const char *const,...)
 

Variables

const struct interface i_Logger
 

Detailed Description

The logger interface.

Author
Georg Hopp

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file logger/interface/logger.h.


Data Structure Documentation

struct i_Logger

Definition at line 36 of file logger/interface/logger.h.

+ Collaboration diagram for i_Logger:
Data Fields
const struct interface *const _
fptr_log log

Typedef Documentation

typedef void(* fptr_log) (void *, logger_level, const char *const)

Definition at line 32 of file logger/interface/logger.h.

Function Documentation

void loggerLog ( void *  ,
logger_level  ,
const char *  const,
  ... 
)

Definition at line 38 of file i_logger.c.

References CALL, MEM_FREE, and memMalloc().

Referenced by main(), serverCtor(), serverHandleAccept(), serverPoll(), serverRead(), serverRun(), serverWrite(), socketAccept(), socketConnect(), socketCtor(), socketListen(), streamRead(), and streamWrite().

38  {
39  Logger object = _object;
40 
41  if (level >= object->min_level) {
42  char * msg = NULL;
43  size_t msg_size = 0;
44  va_list params;
45 
46  va_start(params, fmt);
47  msg_size = vsnprintf(NULL, msg_size, fmt, params);
48  va_end(params);
49 
50  msg = memMalloc(msg_size + 1);
51 
52  va_start(params, fmt);
53  vsnprintf(msg, msg_size + 1, fmt, params);
54  va_end(params);
55 
56 // // ----- DEBUG ------
57 // do {
58 // struct i_Logger * iface;
59 //
60 // do {
61 // class_ptr class = GET_CLASS(_object);
62 // iface = (struct i_Logger *)IFACE_GET(class, &i_Logger);
63 // while ((NULL == iface || NULL == iface->log) && HAS_PARENT(class)) {
64 // class = class->parent;
65 // iface = (struct i_Logger *)IFACE_GET(class, &i_Logger);
66 // }
67 // assert(NULL != iface->log);
68 // } while(0);
69 //
70 // iface->log(_object, level, msg);
71 // } while(0);
72 // // ----- DEBUG ------
73  CALL(_object, Logger, log, level, msg);
74 
75  MEM_FREE(msg);
76  }
77 }
#define MEM_FREE(seg)
Definition: memory.h:28
#define CALL(object, _iface, method,...)
Definition: class/class.h:106
void * memMalloc(size_t)
Definition: memory.c:783

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const struct interface i_Logger

Definition at line 32 of file i_logger.c.