NwMiniLogMgrEntity.h 1.91 KB
Newer Older
Cedric Roux's avatar
 
Cedric Roux committed
1 2 3 4 5 6 7 8
/*----------------------------------------------------------------------------*
 *                                                                            *
 *         M I N I M A L I S T I C    L O G M G R     E N T I T Y             *
 *                                                                            *
 *                    Copyright (C) 2010 Amit Chawre.                         *
 *                                                                            *
 *----------------------------------------------------------------------------*/

9
/**
Cedric Roux's avatar
 
Cedric Roux committed
10 11 12 13 14 15 16 17 18
 * @file hello-world.c
 * @brief This file contains example of a minimalistic log manager entity.
*/

#include <stdio.h>
#include <assert.h>
#include "NwEvt.h"
#include "NwLog.h"

19 20 21
#ifndef __NW_MINI_LOG_MGR_H__
#define __NW_MINI_LOG_MGR_H__

Cedric Roux's avatar
 
Cedric Roux committed
22 23
#ifndef NW_ASSERT
#define NW_ASSERT assert
24
#endif
Cedric Roux's avatar
 
Cedric Roux committed
25

26
extern uint32_t g_log_level;
Cedric Roux's avatar
 
Cedric Roux committed
27 28 29 30 31 32 33 34


#define NW_LOG( _logLevel, ...)                                         \
  do {                                                                  \
    if(g_log_level >= _logLevel)                                        \
    {                                                                   \
      char _logStr[1024];                                               \
      snprintf(_logStr, 1024, __VA_ARGS__);                             \
frtabu's avatar
frtabu committed
35
      printf("NWGTPv2U-APP  %s - %s <%s,%d>\n", gLogLevelStr[_logLevel], _logStr, basename(__FILE__), __LINE__);\
Cedric Roux's avatar
 
Cedric Roux committed
36 37 38
    }                                                                   \
  } while(0)

39
typedef struct {
40
  uint8_t  logLevel;
Cedric Roux's avatar
 
Cedric Roux committed
41 42 43 44 45 46 47
} NwMiniLogMgrT;

#ifdef __cplusplus
extern "C" {
#endif

NwGtpv1uRcT nwMiniLogMgrLogRequest (NwGtpv1uLogMgrHandleT logMgrHandle,
48
                                    uint32_t logLevel,
49
                                    NwCharT* file,
50
                                    uint32_t line,
51
                                    NwCharT* logStr);
Cedric Roux's avatar
 
Cedric Roux committed
52

53
#ifdef __cplusplus
Cedric Roux's avatar
 
Cedric Roux committed
54 55 56 57
}
#endif

#endif