dm_log Module

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.


Uses

  • module~~dm_log~~UsesGraph module~dm_log dm_log module~dm_error dm_error module~dm_log->module~dm_error module~dm_id dm_id module~dm_log->module~dm_id module~dm_kind dm_kind module~dm_log->module~dm_kind module~dm_node dm_node module~dm_log->module~dm_node module~dm_observ dm_observ module~dm_log->module~dm_observ module~dm_sensor dm_sensor module~dm_log->module~dm_sensor module~dm_target dm_target module~dm_log->module~dm_target module~dm_time dm_time module~dm_log->module~dm_time module~dm_uuid dm_uuid module~dm_log->module~dm_uuid module~dm_error->module~dm_kind module~dm_ascii dm_ascii module~dm_error->module~dm_ascii iso_fortran_env iso_fortran_env module~dm_kind->iso_fortran_env module~dm_node->module~dm_id module~dm_node->module~dm_kind module~dm_observ->module~dm_error module~dm_observ->module~dm_id module~dm_observ->module~dm_kind module~dm_observ->module~dm_node module~dm_observ->module~dm_sensor module~dm_observ->module~dm_target module~dm_observ->module~dm_time module~dm_observ->module~dm_uuid module~dm_request dm_request module~dm_observ->module~dm_request module~dm_response dm_response module~dm_observ->module~dm_response module~dm_util dm_util module~dm_observ->module~dm_util module~dm_sensor->module~dm_id module~dm_sensor->module~dm_kind module~dm_sensor->module~dm_node module~dm_target->module~dm_id module~dm_target->module~dm_kind module~dm_target->module~dm_util module~dm_time->module~dm_error module~dm_time->module~dm_kind module~dm_time->module~dm_util module~dm_request->module~dm_error module~dm_request->module~dm_id module~dm_request->module~dm_kind module~dm_request->module~dm_time module~dm_request->module~dm_response module~dm_request->module~dm_util module~dm_string dm_string module~dm_request->module~dm_string module~dm_response->module~dm_error module~dm_response->module~dm_id module~dm_response->module~dm_kind module~dm_response->module~dm_util module~dm_util->module~dm_error module~dm_util->module~dm_kind module~dm_string->module~dm_error module~dm_string->module~dm_kind

Used by

  • module~~dm_log~~UsedByGraph module~dm_log dm_log module~dm_atom dm_atom module~dm_atom->module~dm_log module~dm_logger dm_logger module~dm_logger->module~dm_log module~dm_mqueue dm_mqueue module~dm_mqueue->module~dm_log module~dm_report dm_report module~dm_report->module~dm_log module~dmpack dmpack module~dmpack->module~dm_log module~dmpack->module~dm_atom module~dmpack->module~dm_logger module~dmpack->module~dm_mqueue module~dmpack->module~dm_report module~dm_mqueue_util dm_mqueue_util module~dmpack->module~dm_mqueue_util proc~dm_arg_validate dm_arg_validate proc~dm_arg_validate->module~dm_log proc~dm_db_insert_log dm_db_insert_log proc~dm_db_insert_log->module~dm_log proc~dm_db_select_log dm_db_select_log proc~dm_db_select_log->module~dm_log proc~dm_db_select_logs_by_observ dm_db_select_logs_by_observ proc~dm_db_select_logs_by_observ->module~dm_log proc~dm_html_log dm_html_log proc~dm_html_log->module~dm_log proc~dm_html_logs dm_html_logs proc~dm_html_logs->module~dm_log proc~dm_lua_api_register dm_lua_api_register proc~dm_lua_api_register->module~dm_log proc~dm_test_dummy_log dm_test_dummy_log proc~dm_test_dummy_log->module~dm_log proc~dm_z_compress_type dm_z_compress_type proc~dm_z_compress_type->module~dm_log module~dm_mqueue_util->module~dm_mqueue

Variables

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 log_type in bytes.


Interfaces

public interface operator (==)

Returns whether logs are equal.

  • public pure elemental function dm_log_equals(log1, log2) result(equals)

    Returns .true. if given logs are equal.

    Arguments

    Type IntentOptional Attributes Name
    type(log_type), intent(in) :: log1

    The first log.

    type(log_type), intent(in) :: log2

    The second log.

    Return Value logical


Derived Types

type, public ::  log_type

Log message type.

Components

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).


Functions

public pure elemental function dm_log_equals(log1, log2) result(equals)

Returns .true. if given logs are equal.

Arguments

Type IntentOptional Attributes Name
type(log_type), intent(in) :: log1

The first log.

type(log_type), intent(in) :: log2

The second log.

Return Value logical

public pure elemental function dm_log_is_valid(log) result(valid)

Returns .true. if given log is valid. A log is valid if it conforms to the following rules:

Read more…

Arguments

Type IntentOptional Attributes Name
type(log_type), intent(in) :: log

Log to validate.

Return Value logical

public pure elemental function dm_log_level_from_name(name) result(level)

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.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

Log level name.

Return Value integer

public pure elemental function dm_log_level_from_string(str) result(level)

Return log level from string, either level name or numeric level.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str

Log level name or numeric level.

Return Value integer

public pure elemental function dm_log_level_is_valid(level) result(valid)

Returns .true. if given log level is valid. The following level are valid:

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: level

Log level.

Return Value logical


Subroutines

public subroutine dm_log_out(log, unit)

Prints log to standard output or given file unit.

Arguments

Type IntentOptional Attributes Name
type(log_type), intent(inout) :: log

Log type.

integer, intent(in), optional :: unit

File unit.