liblog/liblog.h

93 lines
2.0 KiB
C

#ifndef LLOG
#define LLOG
/** Liblog Commands Table
State [deprecated, see "Log level"]
Verbosity
Editing
Advanced behaviour
*/
/*** [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;
/* ll_set_state(log_state_t):
sets log state */
void ll_set_state(log_state_t);
/* ll_get_state():
return log state */
log_state_t ll_get_state(void);
/*** Log level:
Customs verbosities for the log stream ->messages have custom levels
Default value is LEVEL_INFO
LEVEL_QUIET disables all types of messages */
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, ...):
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, ...);
/* 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);
#endif