ngfd-plugin: /build/ngfd/src/ngfd-1.4.1/src/include/ngf/log.h Source File

ngfd-plugin

log.h
Go to the documentation of this file.
1/*
2 * ngfd - Non-graphic feedback daemon
3 *
4 * Copyright (C) 2010 Nokia Corporation.
5 * Contact: Xun Chen <xun.chen@nokia.com>
6 *
7 * This work is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This work is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this work; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef N_LOG_H
23#define N_LOG_H
24
25#include <stdarg.h>
26
27 typedef enum _NLogTarget
28{
30 N_LOG_TARGET_NONE = 0,
31
33 N_LOG_TARGET_STDOUT,
34
36 N_LOG_TARGET_SYSLOG
37} NLogTarget;
38
40 typedef enum _NLogLevel
41{
43 N_LOG_LEVEL_ENTER = 0,
45 N_LOG_LEVEL_DEBUG = 1,
47 N_LOG_LEVEL_INFO = 2,
49 N_LOG_LEVEL_WARNING = 3,
51 N_LOG_LEVEL_ERROR = 4,
53 N_LOG_LEVEL_NONE = 5
54} NLogLevel;
55
59 void n_log_initialize (NLogLevel level);
60
64 void n_log_set_level (NLogLevel level);
65
68 NLogLevel n_log_get_level ();
69
73 void n_log_set_target (NLogTarget target);
74
78 NLogTarget n_log_get_target ();
79
87 void n_log_message (NLogLevel level, const char *function, int line, const char *fmt, ...);
88
90#define N_ENTER(...) \
91 do { n_log_message (N_LOG_LEVEL_ENTER, (const char*) __FUNCTION__, __LINE__, __VA_ARGS__); } while(0)
92
94#define N_DEBUG(...) \
95 do { n_log_message (N_LOG_LEVEL_DEBUG, (const char*) __FUNCTION__, __LINE__, __VA_ARGS__); } while(0)
96
98#define N_INFO(...) \
99 do { n_log_message (N_LOG_LEVEL_INFO, (const char*) __FUNCTION__, __LINE__, __VA_ARGS__); } while(0)
100
102#define N_WARNING(...) \
103 do { n_log_message (N_LOG_LEVEL_WARNING, (const char*) __FUNCTION__, __LINE__, __VA_ARGS__); } while(0)
104
106#define N_ERROR(...) \
107 do { n_log_message (N_LOG_LEVEL_ERROR, (const char*) __FUNCTION__, __LINE__, __VA_ARGS__); } while(0)
108
109#endif /* N_LOG_H */
n_log_message
void n_log_message(NLogLevel level, const char *function, int line, const char *fmt,...)
Log message.
n_log_initialize
void n_log_initialize(NLogLevel level)
Initialize logging with selected level.
n_log_get_level
NLogLevel n_log_get_level()
Get current logging level.
_NLogLevel
_NLogLevel
Logging levels.
Definition log.h:41
N_LOG_LEVEL_ENTER
@ N_LOG_LEVEL_ENTER
Function enter messages.
Definition log.h:43
N_LOG_LEVEL_ERROR
@ N_LOG_LEVEL_ERROR
Error messages.
Definition log.h:51
N_LOG_LEVEL_NONE
@ N_LOG_LEVEL_NONE
Suppress logging.
Definition log.h:53
N_LOG_LEVEL_INFO
@ N_LOG_LEVEL_INFO
Info messages.
Definition log.h:47
N_LOG_LEVEL_DEBUG
@ N_LOG_LEVEL_DEBUG
Debug messages.
Definition log.h:45
N_LOG_LEVEL_WARNING
@ N_LOG_LEVEL_WARNING
Warning messages.
Definition log.h:49
NLogTarget
enum _NLogTarget NLogTarget
NLogLevel
enum _NLogLevel NLogLevel
Logging levels.
n_log_set_level
void n_log_set_level(NLogLevel level)
Change logging level.
n_log_get_target
NLogTarget n_log_get_target()
Get current log target.
n_log_set_target
void n_log_set_target(NLogTarget target)
Select log target.
_NLogTarget
_NLogTarget
Definition log.h:28
N_LOG_TARGET_NONE
@ N_LOG_TARGET_NONE
Suppress logging.
Definition log.h:30
N_LOG_TARGET_SYSLOG
@ N_LOG_TARGET_SYSLOG
Direct logging to syslog.
Definition log.h:36
N_LOG_TARGET_STDOUT
@ N_LOG_TARGET_STDOUT
Direct logging to stdout.
Definition log.h:33