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
38
55
60
65
69
74
79
87void 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 */
void n_log_message(NLogLevel level, const char *function, int line, const char *fmt,...)
Log message.
void n_log_initialize(NLogLevel level)
Initialize logging with selected level.
NLogLevel n_log_get_level()
Get current logging level.
_NLogLevel
Logging levels.
Definition log.h:41
@ N_LOG_LEVEL_ENTER
Function enter messages.
Definition log.h:43
@ N_LOG_LEVEL_ERROR
Error messages.
Definition log.h:51
@ N_LOG_LEVEL_NONE
Suppress logging.
Definition log.h:53
@ N_LOG_LEVEL_INFO
Info messages.
Definition log.h:47
@ N_LOG_LEVEL_DEBUG
Debug messages.
Definition log.h:45
@ N_LOG_LEVEL_WARNING
Warning messages.
Definition log.h:49
enum _NLogTarget NLogTarget
enum _NLogLevel NLogLevel
Logging levels.
void n_log_set_level(NLogLevel level)
Change logging level.
NLogTarget n_log_get_target()
Get current log target.
void n_log_set_target(NLogTarget target)
Select log target.
_NLogTarget
Definition log.h:28
@ N_LOG_TARGET_NONE
Suppress logging.
Definition log.h:30
@ N_LOG_TARGET_SYSLOG
Direct logging to syslog.
Definition log.h:36
@ N_LOG_TARGET_STDOUT
Direct logging to stdout.
Definition log.h:33