1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*----------------------------------------------------------------------------*
* *
* 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. *
* *
*----------------------------------------------------------------------------*/
/**
* @file hello-world.c
* @brief This file contains example of a minimalistic log manager entity.
*/
#include <stdio.h>
#include <assert.h>
#include "NwLog.h"
#include "NwEvt.h"
#include "NwGtpv1u.h"
#include "NwMiniLogMgrEntity.h"
#ifdef __cplusplus
extern "C" {
#endif
uint32_t g_log_level = NW_LOG_LEVEL_INFO;
/*---------------------------------------------------------------------------
* Public functions
*--------------------------------------------------------------------------*/
NwGtpv1uRcT nwMiniLogMgrInit(NwMiniLogMgrT *thiz, uint32_t logLevel )
{
thiz->logLevel = logLevel;
return NW_GTPV1U_OK;
}
NwGtpv1uRcT nwMiniLogMgrSetLogLevel(NwMiniLogMgrT *thiz, uint32_t logLevel)
{
thiz->logLevel = logLevel;
}
NwGtpv1uRcT nwMiniLogMgrLogRequest (NwGtpv1uLogMgrHandleT hLogMgr,
uint32_t logLevel,
NwCharT *file,
uint32_t line,
NwCharT *logStr)
{
NwMiniLogMgrT *thiz = (NwMiniLogMgrT *) hLogMgr;
if(thiz->logLevel >= logLevel) {
printf("NWGTPv2U-STK %s - %s <%s,%u>\n", gLogLevelStr[logLevel], logStr,
basename(file), line);
}
return NW_GTPV1U_OK;
}
#ifdef __cplusplus
}
#endif