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 * Copyright (c) 2025 Jolla Mobile Ltd
7 *
8 * This work is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This work is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this work; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef N_LOG_H
24#define N_LOG_H
25
26#include <stdarg.h>
27
42
59
64
69
73
78
83
91void n_log_message (NLogLevel level, const char *function, int line, const char *fmt, ...);
92
94#define N_ENTER(...) \
95 do { n_log_message (N_LOG_LEVEL_ENTER, (const char*) __FUNCTION__, __LINE__, __VA_ARGS__); } while(0)
96
98#define N_DEBUG(...) \
99 do { n_log_message (N_LOG_LEVEL_DEBUG, (const char*) __FUNCTION__, __LINE__, __VA_ARGS__); } while(0)
100
102#define N_INFO(...) \
103 do { n_log_message (N_LOG_LEVEL_INFO, (const char*) __FUNCTION__, __LINE__, __VA_ARGS__); } while(0)
104
106#define N_WARNING(...) \
107 do { n_log_message (N_LOG_LEVEL_WARNING, (const char*) __FUNCTION__, __LINE__, __VA_ARGS__); } while(0)
108
110#define N_ERROR(...) \
111 do { n_log_message (N_LOG_LEVEL_ERROR, (const char*) __FUNCTION__, __LINE__, __VA_ARGS__); } while(0)
112
113#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:45
@ N_LOG_LEVEL_ENTER
Function enter messages.
Definition log.h:47
@ N_LOG_LEVEL_ERROR
Error messages.
Definition log.h:55
@ N_LOG_LEVEL_NONE
Suppress logging.
Definition log.h:57
@ N_LOG_LEVEL_INFO
Info messages.
Definition log.h:51
@ N_LOG_LEVEL_DEBUG
Debug messages.
Definition log.h:49
@ N_LOG_LEVEL_WARNING
Warning messages.
Definition log.h:53
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:29
@ N_LOG_TARGET_NONE
Suppress logging.
Definition log.h:31
@ N_LOG_TARGET_STDERR
Direct logging to stderr.
Definition log.h:34
@ N_LOG_TARGET_SYSLOG
Direct logging to syslog.
Definition log.h:40
@ N_LOG_TARGET_STDOUT
Direct logging to stdout.
Definition log.h:37