liblog/liblog.h

93 lines
2.0 KiB
C
Raw Normal View History

2019-09-18 17:44:47 +02:00
#ifndef LLOG
#define LLOG
2020-01-02 22:07:04 +01:00
/** Liblog Commands Table
State [deprecated, see "Log level"]
Verbosity
Editing
Advanced behaviour
*/
2019-09-28 14:28:05 +02:00
2019-09-18 18:27:57 +02:00
2019-09-18 17:44:47 +02:00
2020-01-02 22:07:04 +01:00
/*** [deprecated] Log state
-> using "Log level" is recommended
Enables or disable the log state
It increases performances and then you can choose to enable|disable logging during execution */
typedef enum {LOG_ENABLE=0,LOG_DISABLE=1} log_state_t;
2019-09-18 17:44:47 +02:00
2020-01-02 22:07:04 +01:00
/* ll_set_state(log_state_t):
sets log state */
void ll_set_state(log_state_t);
2020-01-02 22:07:04 +01:00
/* ll_get_state():
return log state */
log_state_t ll_get_state(void);
2019-09-18 17:44:47 +02:00
2020-01-02 22:07:04 +01:00
/*** Log level:
Customs verbosities for the log stream ->messages have custom levels
2020-01-03 20:45:37 +01:00
Default value is LEVEL_INFO
LEVEL_QUIET disables all types of messages */
2020-01-02 22:07:04 +01:00
typedef enum {LEVEL_BLABLA, LEVEL_INFO, LEVEL_WARNING, LEVEL_CRITICAL, LEVEL_FATAL, LEVEL_MAX, LEVEL_QUIET} log_level_t;
/* ll_set_level(log_level_t):
sets log verbosity */
void ll_set_level(log_level_t);
/* ll_get_level():
return log level */
log_level_t ll_set_level(void);
/*** Log editing
Use the following functions to send messages
These commands does support '\n' */
/* ll_send(char const *)[deprecated]:
Print text
This function sends the message with a maximal priority
It will be ignored only if the log is disabled or set to quiet (same thing) */
void ll_send(char const *);
/* ll_sendp(log_level_t priority, char const * format, ...):
2020-01-02 22:07:04 +01:00
Print text
This function sends the message with a custom priority
Note: A message sent with `LEVEL_QUIET` counts as a `LEVEL_MAX` log */
void ll_sendp(log_level_t p, char const *format, ...);
2020-01-02 22:07:04 +01:00
/* ll_clear():
Reset log */
void ll_clear(void);
/*** Log displaying
Here are different functions to display a log
There are both in fullscreen */
/* ll_display():
One frame displaying
It shows the last lines of the log, without scrolling ability */
void ll_display(void);
/* ll_pause():
Display log, enable scrolling with arrows, and waits the user to press Exit */
void ll_pause(void);
/*** Advanced behaviour
This funciont sets the behaviour when an exception occurs
*/
void ll_set_panic(void);
2019-10-01 19:30:42 +02:00
2019-09-18 17:44:47 +02:00
#endif