| 1 | /* -*- Mode: C ; c-basic-offset: 2 -*- */ |
|---|
| 2 | /***************************************************************************** |
|---|
| 3 | * |
|---|
| 4 | * Copyright (C) 2006,2007,2008,2009 Nedko Arnaudov <nedko@arnaudov.name> |
|---|
| 5 | * |
|---|
| 6 | * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; version 2 of the License |
|---|
| 9 | * |
|---|
| 10 | * This program is distributed in the hope that it will be useful, |
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | * GNU General Public License for more details. |
|---|
| 14 | * |
|---|
| 15 | * You should have received a copy of the GNU General Public License |
|---|
| 16 | * along with this program; if not, write to the Free Software |
|---|
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|---|
| 18 | * |
|---|
| 19 | *****************************************************************************/ |
|---|
| 20 | |
|---|
| 21 | #ifndef LOG_H__7097F6FE_4FEE_4962_9542_60375961F567__INCLUDED |
|---|
| 22 | #define LOG_H__7097F6FE_4FEE_4962_9542_60375961F567__INCLUDED |
|---|
| 23 | |
|---|
| 24 | void lv2log(int level, const char * format, ...); |
|---|
| 25 | |
|---|
| 26 | #define LOG_LEVEL_DEBUG 0 |
|---|
| 27 | #define LOG_LEVEL_INFO 1 |
|---|
| 28 | #define LOG_LEVEL_WARNING 2 |
|---|
| 29 | #define LOG_LEVEL_NOTICE 3 |
|---|
| 30 | #define LOG_LEVEL_ERROR 4 |
|---|
| 31 | #define LOG_LEVEL_FATAL 5 |
|---|
| 32 | #define LOG_LEVEL_BLACK_HOLE 6 |
|---|
| 33 | |
|---|
| 34 | #if !defined(LOG_LEVEL) |
|---|
| 35 | #define LOG_LEVEL LOG_LEVEL_WARNING |
|---|
| 36 | #endif |
|---|
| 37 | |
|---|
| 38 | #if LOG_LEVEL <= LOG_LEVEL_DEBUG |
|---|
| 39 | # define LOG_DEBUG(format, arg...) \ |
|---|
| 40 | lv2log(LOG_LEVEL_DEBUG, \ |
|---|
| 41 | format "\n", ## arg) |
|---|
| 42 | #else |
|---|
| 43 | # define LOG_DEBUG(format, arg...) |
|---|
| 44 | #endif |
|---|
| 45 | |
|---|
| 46 | #if LOG_LEVEL <= LOG_LEVEL_INFO |
|---|
| 47 | # define LOG_INFO(format, arg...) \ |
|---|
| 48 | lv2log(LOG_LEVEL_INFO, \ |
|---|
| 49 | format "\n", ## arg) |
|---|
| 50 | #else |
|---|
| 51 | # define LOG_INFO(format, arg...) |
|---|
| 52 | #endif |
|---|
| 53 | |
|---|
| 54 | #if LOG_LEVEL <= LOG_LEVEL_WARNING |
|---|
| 55 | # define LOG_WARNING(format, arg...) \ |
|---|
| 56 | lv2log(LOG_LEVEL_WARNING, \ |
|---|
| 57 | format "\n", ## arg) |
|---|
| 58 | #else |
|---|
| 59 | # define LOG_WARNING(format, arg...) |
|---|
| 60 | #endif |
|---|
| 61 | |
|---|
| 62 | #if LOG_LEVEL <= LOG_LEVEL_NOTICE |
|---|
| 63 | # define LOG_NOTICE(format, arg...) \ |
|---|
| 64 | lv2log(LOG_LEVEL_NOTICE, \ |
|---|
| 65 | format "\n", ## arg) |
|---|
| 66 | #else |
|---|
| 67 | # define LOG_NOTICE(format, arg...) |
|---|
| 68 | #endif |
|---|
| 69 | |
|---|
| 70 | #if LOG_LEVEL <= LOG_LEVEL_ERROR |
|---|
| 71 | # define LOG_ERROR(format, arg...) \ |
|---|
| 72 | lv2log(LOG_LEVEL_ERROR, \ |
|---|
| 73 | format "\n", ## arg) |
|---|
| 74 | #else |
|---|
| 75 | # define LOG_ERROR(format, arg...) |
|---|
| 76 | #endif |
|---|
| 77 | |
|---|
| 78 | #if LOG_LEVEL <= LOG_LEVEL_FATAL |
|---|
| 79 | # define LOG_FATAL(format, arg...) \ |
|---|
| 80 | lv2log(LOG_LEVEL_FATAL, \ |
|---|
| 81 | format "\n", ## arg) |
|---|
| 82 | #else |
|---|
| 83 | # define LOG_FATAL(format, arg...) |
|---|
| 84 | #endif |
|---|
| 85 | |
|---|
| 86 | #endif /* #ifndef LOG_H__7097F6FE_4FEE_4962_9542_60375961F567__INCLUDED */ |
|---|