1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
4 * This file is part of gsignond
6 * Copyright (C) 2012-2013 Intel Corporation.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25 #ifndef __GSIGNOND_LOG_H_
26 #define __GSIGNOND_LOG_H_
37 * SECTION:gsignond-log
38 * @short_description: logging facilities
40 * @include: gsignond/gsignond-log.h
42 * <filename>gsignond/gsignond-log.h</filename> file contains logging macros
43 * that plugins and extensions should use for debugging and tracing.
46 * |[ INFO("Plugin %s initialized", plugin_mechanism); ]|
52 * This macro prints the current function call stack to stderr.
60 fprintf (stderr, "Backtrace for: %s %s\n", __FILE__, __PRETTY_FUNCTION__); \
61 size = backtrace (array, 256);\
62 strings = backtrace_symbols (array, size);\
64 for (i=0; i <size; i++) fprintf (stderr, "\t%s\n", strings[i]);\
71 * @frmt: format string for the message
72 * @...: arguments for the format string
74 * Use this macro to log error messages. GSignond will take care of
75 * correctly saving them.
77 #define ERR(frmt, args...) g_critical("%f %s:%d %s " frmt , \
78 g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \
79 __PRETTY_FUNCTION__, ##args)
83 * @frmt: format string for the message
84 * @...: arguments for the format string
86 * Use this macro to log warning messages. GSignond will take care of
87 * correctly saving them.
89 #define WARN(frmt, args...) g_warning("%f %s:%d %s " frmt , \
90 g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \
91 __PRETTY_FUNCTION__, ##args)
96 * @frmt: format string for the message
97 * @...: arguments for the format string
99 * Use this macro to log informational messages. GSignond will take care of
100 * correctly saving them.
102 #define INFO(frmt, args...) g_message("%f %s:%d %s " frmt , \
103 g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \
104 __PRETTY_FUNCTION__, ##args)
108 * @frmt: format string for the message
109 * @...: arguments for the format string
111 * Use this macro to log debug messages. GSignond will take care of
112 * correctly saving them.
114 #define DBG(frmt, args...) g_debug("%f %s:%d %s " frmt , \
115 g_get_monotonic_time()*1.0e-6, __FILE__, __LINE__, \
116 __PRETTY_FUNCTION__, ##args)
118 # define INFO(frmt, args...)
119 # define DBG(frmt, args...)
122 #endif /* __GSIGNOND_LOG_H_ */