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

Go to the source code of this file.

Typedefs

typedef void(* fptr_TR_log) (void *, TR_logger_level, const char *const)
 

Functions

 TR_INTERFACE (TR_Logger)
 
void TR_loggerLog (void *, TR_logger_level, const char *const,...)
 

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 interface/logger.h.

Typedef Documentation

typedef void(* fptr_TR_log) (void *, TR_logger_level, const char *const)

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

Function Documentation

TR_INTERFACE ( TR_Logger  )

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

References TR_IFID.

33  {
34  TR_IFID;
35  fptr_TR_log log;
36 };
#define TR_IFID
Definition: interface.h:61
void(* fptr_TR_log)(void *, TR_logger_level, const char *const)
void TR_loggerLog ( void *  ,
TR_logger_level  ,
const char *  const,
  ... 
)

Definition at line 32 of file i_logger.c.

References TR_CALL, TR_malloc(), and TR_MEM_FREE.

36  {
37  TR_Logger object = _object;
38 
39  if (level >= object->min_level) {
40  char * msg = NULL;
41  size_t msg_size = 0;
42  va_list params;
43 
44  va_start(params, fmt);
45  msg_size = vsnprintf(NULL, msg_size, fmt, params);
46  va_end(params);
47 
48  msg = TR_malloc(msg_size + 1);
49 
50  va_start(params, fmt);
51  vsnprintf(msg, msg_size + 1, fmt, params);
52  va_end(params);
53 
54  TR_CALL(_object, TR_Logger, log, level, msg);
55 
56  TR_MEM_FREE(msg);
57  }
58 }
#define TR_CALL(object, _iface, method,...)
Definition: class.h:256
void * TR_malloc(size_t)
Definition: memory.c:178
#define TR_MEM_FREE(seg)
Definition: memory.h:26

+ Here is the call graph for this function: