ctdb-logging: Remove debug levels DEBUG_ALERT and DEBUG_CRIT
[Samba.git] / ctdb / common / ctdb_logging.c
blobc79397d03f053d380689be04b76ef2abec7643fd
1 /*
2 ctdb logging code
4 Copyright (C) Ronnie Sahlberg 2009
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; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #include "includes.h"
21 #include "tdb.h"
22 #include "system/time.h"
23 #include "../include/ctdb_private.h"
24 #include "../include/ctdb_client.h"
26 const char *debug_extra = "";
28 struct debug_levels debug_levels[] = {
29 {DEBUG_ERR, "ERR"},
30 {DEBUG_WARNING, "WARNING"},
31 {DEBUG_NOTICE, "NOTICE"},
32 {DEBUG_INFO, "INFO"},
33 {DEBUG_DEBUG, "DEBUG"},
34 {0, NULL}
37 const char *get_debug_by_level(int32_t level)
39 int i;
41 for (i=0; debug_levels[i].description != NULL; i++) {
42 if (debug_levels[i].level == level) {
43 return debug_levels[i].description;
46 return "Unknown";
49 int32_t get_debug_by_desc(const char *desc)
51 int i;
53 for (i=0; debug_levels[i].description != NULL; i++) {
54 if (!strcasecmp(debug_levels[i].description, desc)) {
55 return debug_levels[i].level;
59 return DEBUG_ERR;