Log type and log level declaration.
The following log levels are supported:
Level | String | Description |
---|---|---|
0 | none |
Invalid log level (unused). |
1 | debug |
Debug messages. |
2 | info |
Hint message. |
3 | warning |
Warning message. |
4 | error |
Non-critical error message. |
5 | critical |
Critical error message (not used by DMPACK). |
6 | user |
User-defined level (not used by DMPACK). |
Log level critical is reserved for monitoring events and not used by DMPACK internally. Level user is reserved for user-defined events and also not used.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | LL_NONE | = | 0 |
Invalid log level, not used by DMPACK. |
integer, | public, | parameter | :: | LL_DEBUG | = | 1 |
For debugging purposes. |
integer, | public, | parameter | :: | LL_INFO | = | 2 |
For information regarding normal system behaviour. |
integer, | public, | parameter | :: | LL_WARNING | = | 3 |
For events requiring the attention of the system operator. |
integer, | public, | parameter | :: | LL_ERROR | = | 4 |
Unexpected behaviour, may indicate failure. |
integer, | public, | parameter | :: | LL_CRITICAL | = | 5 |
Reserved for monitoring events, not used by DMPACK internally. |
integer, | public, | parameter | :: | LL_USER | = | 6 |
User-defined level, not used by DMPACK. |
integer, | public, | parameter | :: | LL_LAST | = | 6 |
Never use this. |
integer, | public, | parameter | :: | LOG_NLEVEL | = | LL_LAST+1 |
Number of log level. |
integer, | public, | parameter | :: | LOG_ID_LEN | = | UUID_LEN |
Max. log id length. |
integer, | public, | parameter | :: | LOG_SOURCE_LEN | = | ID_LEN |
Max. log source length. |
integer, | public, | parameter | :: | LOG_MESSAGE_LEN | = | 512 |
Max. log message length. |
integer, | public, | parameter | :: | LOG_LEVEL_NAME_LEN | = | 8 | |
character(len=*), | public, | parameter | :: | LOG_LEVEL_NAMES(0:LL_LAST) | = | [character(len=LOG_LEVEL_NAME_LEN)::'NONE', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL', 'USER'] |
Log level strings. |
character(len=*), | public, | parameter | :: | LOG_LEVEL_NAMES_LOWER(0:LL_LAST) | = | [character(len=LOG_LEVEL_NAME_LEN)::'none', 'debug', 'info', 'warning', 'error', 'critical', 'user'] |
Log level strings in lower-case. |
integer, | public, | parameter | :: | LOG_SIZE | = | storage_size(log_type())/8 |
Size of |
Returns whether logs are equal.
Returns .true.
if given logs are equal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(log_type), | intent(in) | :: | log1 |
The first log. |
||
type(log_type), | intent(in) | :: | log2 |
The second log. |
Log message type.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=LOG_ID_LEN), | public | :: | id | = | UUID_DEFAULT |
Database log id (mandatory). |
|
integer, | public | :: | level | = | LL_WARNING |
Log level (mandatory). |
|
integer, | public | :: | error | = | E_NONE |
Error code (optional). |
|
character(len=TIME_LEN), | public | :: | timestamp | = | TIME_DEFAULT |
Timestamp, shall be in ISO 8601 plus milliseconds and time zone (mandatory). |
|
character(len=NODE_ID_LEN), | public | :: | node_id | = | ' ' |
Sensor node ID (optional). |
|
character(len=SENSOR_ID_LEN), | public | :: | sensor_id | = | ' ' |
Sensor ID (optional). |
|
character(len=TARGET_ID_LEN), | public | :: | target_id | = | ' ' |
Target ID (optional). |
|
character(len=OBSERV_ID_LEN), | public | :: | observ_id | = | ' ' |
Observation ID (optional). |
|
character(len=LOG_SOURCE_LEN), | public | :: | source | = | ' ' |
Log message source (optional). |
|
character(len=LOG_MESSAGE_LEN), | public | :: | message | = | ' ' |
Log message (mandatory). |
Returns .true.
if given log is valid. A log is valid if it conforms
to the following rules:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(log_type), | intent(in) | :: | log |
Log to validate. |
Returns log level from string argument name
. The string is
converted to lower-case before. If name
neither matches none
,
debug
, warning
, error
, critical
, nor user
this function
returns LL_NONE
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name |
Log level name. |
Return log level from string, either level name or numeric level.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str |
Log level name or numeric level. |
Returns .true.
if given log level is valid. The following level
are valid:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | level |
Log level. |
Prints log to standard output or given file unit.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(log_type), | intent(inout) | :: | log |
Log type. |
||
integer, | intent(in), | optional | :: | unit |
File unit. |