OLE Developer Guide  Latest Git
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
syslog.h
Go to the documentation of this file.
1 /*
2  * This library is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2.1 of the License, or (at your option) any later version.
6  *
7  * This library is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10  * Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public
13  * License along with this library; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15  *
16  * syslog.h
17  * Copyright (C) 2015 Simon Newton
18  */
19 
48 #ifndef FIRMWARE_SRC_SYSLOG_H_
49 #define FIRMWARE_SRC_SYSLOG_H_
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
58 typedef enum {
65 } SysLogLevel;
66 
71 typedef void (*SysLogWriteFn)(const char*);
72 
80 void SysLog_Initialize(SysLogWriteFn write_fn);
81 
88 void SysLog_Message(SysLogLevel level, const char* msg);
89 
96 void SysLog_Print(SysLogLevel level, const char* format, ...);
97 
103 
108 void SysLog_SetLevel(SysLogLevel level);
109 
113 void SysLog_Increment();
114 
118 void SysLog_Decrement();
119 
126 const char* SysLog_LevelToString(SysLogLevel level);
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
136 #endif // FIRMWARE_SRC_SYSLOG_H_
void SysLog_Increment()
Increase the verbosity of the logging.
const char * SysLog_LevelToString(SysLogLevel level)
Return the string description of a log level.
void SysLog_Print(SysLogLevel level, const char *format,...)
Format and log a message.
void SysLog_Decrement()
Decrease the verbosity of the logging.
void SysLog_Message(SysLogLevel level, const char *msg)
Log a message.
Warnings.
Definition: syslog.h:61
void(* SysLogWriteFn)(const char *)
A function pointer to log a message.
Definition: syslog.h:71
SysLogLevel SysLog_GetLevel()
Return the current log level.
void SysLog_SetLevel(SysLogLevel level)
Set the log level.
SysLogLevel
The system log levels.
Definition: syslog.h:58
Debug messages.
Definition: syslog.h:59
Errors.
Definition: syslog.h:62
Info messages.
Definition: syslog.h:60
Always logged regardless of log level.
Definition: syslog.h:64
void SysLog_Initialize(SysLogWriteFn write_fn)
Initialize the System Logging module.
Fatal events.
Definition: syslog.h:63