2 * Copyright Droids Corporation, Microb Technology, Eirbot (2005)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Revision : $Id: error.c,v 1.10.4.3 2007-12-31 16:25:00 zer0 Exp $
30 #include <aversive/error.h>
32 struct error_fct g_error_fct;
34 /** All fcts pointers to NULL */
39 memset(&g_error_fct, 0, sizeof(g_error_fct));
44 struct error error_generate(uint8_t num, uint8_t severity, PGM_P t,
45 PGM_P f, uint16_t l) {
49 e.severity = severity;
50 #ifdef ERROR_DUMP_TEXTLOG
55 #ifdef ERROR_DUMP_FILE_LINE
66 /** Register log function for EMERG level */
67 void error_register_emerg(void (*f)(struct error *, ...))
71 g_error_fct.emerg = f;
75 /** Register log function for ERROR level */
76 void error_register_error(void (*f)(struct error *, ...))
80 g_error_fct.error = f;
84 /** Register log function for WARNING level */
85 void error_register_warning(void (*f)(struct error *, ...))
89 g_error_fct.warning = f;
93 /** Register log function for NOTICE level */
94 void error_register_notice(void (*f)(struct error *, ...))
98 g_error_fct.notice = f;
102 /** Register log function for DEBUG level */
103 void error_register_debug(void (*f)(struct error *, ...))
107 g_error_fct.debug = f;