gmerlin
log.h
1 /*****************************************************************
2  * gmerlin - a general purpose multimedia framework and applications
3  *
4  * Copyright (c) 2001 - 2011 Members of the Gmerlin project
5  * gmerlin-general@lists.sourceforge.net
6  * http://gmerlin.sourceforge.net
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program 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
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  * *****************************************************************/
21 
22 #ifndef __BG_LOG_H_
23 #define __BG_LOG_H_
24 
25 /* Gmerlin log facilities */
26 
27 #include <gmerlin/parameter.h>
28 #include <gmerlin/msgqueue.h>
29 
30 #include <libintl.h>
31 
51 typedef enum
52  {
53  BG_LOG_DEBUG = 1<<0,
54  BG_LOG_WARNING = 1<<1,
55  BG_LOG_ERROR = 1<<2,
56  BG_LOG_INFO = 1<<3
58 
59 #define BG_LOG_LEVEL_MAX (1<<3)
60 
75 void bg_log_notranslate(bg_log_level_t level, const char * domain,
76  const char * format, ...) __attribute__ ((format (printf, 3, 4)));
77 
92 void bg_logs_notranslate(bg_log_level_t level, const char * domain,
93  const char * str);
94 
95 
96 
112 void bg_log_translate(const char * translation_domain,
113  bg_log_level_t level, const char * domain,
114  const char * format, ...) __attribute__ ((format (printf, 4, 5)));
115 
120 #define bg_log(level, domain, ...) \
121  bg_log_translate(PACKAGE, level, domain, __VA_ARGS__)
122 
123 
140 
147 const char * bg_log_level_to_string(bg_log_level_t level);
148 
157 void bg_log_set_verbose(int mask);
158 
167 char * bg_log_last_error();
168 
174 void bg_log_syslog_init(const char * name);
175 
181 void bg_log_syslog_flush();
182 
183 
184 
185 #endif // __BG_LOG_H_
void bg_log_set_dest(bg_msg_queue_t *q)
Set the log destination.
Something interesting the user might want to know.
Definition: log.h:56
void bg_log_syslog_flush()
void bg_log_notranslate(bg_log_level_t level, const char *domain, const char *format,...) __attribute__((format(printf
Send a message to the logger without translating it.
void bg_log_syslog_init(const char *name)
Initialize syslog logging.
char * bg_log_last_error()
Get last error message.
const char * bg_log_level_to_string(bg_log_level_t level)
Convert a log level to a human readable string.
Something went wrong, cannot continue.
Definition: log.h:55
Something went wrong, but is not fatal.
Definition: log.h:54
Only for programmers, useless for users.
Definition: log.h:53
void void bg_logs_notranslate(bg_log_level_t level, const char *domain, const char *str)
Send a message (as complete string) to the logger without translating it.
bg_log_level_t
Log levels.
Definition: log.h:51
void bg_log_translate(const char *translation_domain, bg_log_level_t level, const char *domain, const char *format,...) __attribute__((format(printf
Translate a message and send it to the logger.
void bg_log_set_verbose(int mask)
Set verbosity mask.
struct bg_msg_queue_s bg_msg_queue_t
Opaque message queue type. You don't want to know what's inside.
Definition: msgqueue.h:447