-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathseverity.c
More file actions
37 lines (31 loc) · 1.24 KB
/
severity.c
File metadata and controls
37 lines (31 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*******************************************************************************
* File: severity.c
* Created: 2021-10-06
*
* Authors:
* Tyler Matijevich
*
* License:
* This file severity.c is part of the UserLog project
* released under the MIT license agreement.
******************************************************************************/
#include "Main.h"
/* Suppress DEBUG messages by default */
UserLogSeverityEnum severity_level = USERLOG_SEVERITY_SUCCESS;
const uint8_t severity_map[] = {
arEVENTLOG_SEVERITY_INFO, /* USERLOG_SEVERITY_DEBUG */
arEVENTLOG_SEVERITY_SUCCESS, /* USERLOG_SEVERITY_SUCCESS */
arEVENTLOG_SEVERITY_INFO, /* USERLOG_SEVERITY_INFORMATION */
arEVENTLOG_SEVERITY_WARNING, /* USERLOG_SEVERITY_WARNING */
arEVENTLOG_SEVERITY_ERROR, /* USERLOG_SEVERITY_ERROR */
arEVENTLOG_SEVERITY_ERROR}; /* USERLOG_SEVERITY_CRITICAL */
/* Suppress messages below the input level and return previous level */
int32_t UserLogSetSeverityLevel(int32_t Level)
{
/* Store previous global level */
UserLogSeverityEnum previous = severity_level;
/* Saturate level */
Level = MIN(MAX(USERLOG_SEVERITY_DEBUG, Level), USERLOG_SEVERITY_CRITICAL);
severity_level = Level;
return previous;
}