# Module cloudi_core_i_logger

- Description
- Data Types
- Function Index
- Function Details

### CloudI Logger

.

Copyright © 2009-2021 Michael Truog

Version: 2.0.2 Dec 3 2021 17:15:36 ------------------------------------------------------------------------

Behaviours: `gen_server`.

Authors: Michael Truog (`mjtruog at protonmail dot com`).

## Description

### CloudI Logger

## Data Types

### mode_interface()

`mode_interface() = async | sync`

## Function Index

code_change/3 |
datetime_to_string/1 | #### Create an ISO8601 timestamp from a datetime in UTC. .
debug/8 | #### Debug log message. which reports subsystem data that should be useful for debugging.
error/8 | #### Error log message. which indicates a subsystem has failed but the failure is not fatal.
fatal/8 | #### Critical log message. which indicates the system has failed and can not continue.
file_set/1 | #### Change the file output path. .
format/2 | #### Lager formatter example with default output. .
format/3 | #### Lager formatter example with default output. .
formatters_set/1 | #### Change the logging formatters. .
handle_call/3 |
handle_cast/2 |
handle_info/2 |
info/8 | #### Info log message. which indicates a subsystem has changed state.
init/1 |
level_set/1 | #### Change the file output log level. .
metadata_get/0 | #### Get metadata. .
metadata_set/1 | #### Set metadata. .
microseconds_to_string/1 | #### Create an ISO8601 timestamp from microseconds since the UNIX epoch. (The UNIX epoch is 1970-01-01T00:00:00.000000Z).
milliseconds_to_string/1 | #### Create an ISO8601 timestamp from milliseconds since the UNIX epoch. (The UNIX epoch is 1970-01-01T00:00:00.000Z).
redirect_set/1 | #### Redirect this node's logging to a different node. .
redirect_update/1 | #### Update the destination of logging output. .
seconds_to_string/1 | #### Create an ISO8601 timestamp from seconds since the UNIX epoch. (The UNIX epoch is 1970-01-01T00:00:00Z).
set/1 | #### Change the logging configuration. .
start_link/1 | #### Start the logging server with the supplied configuration. .
status/1 | #### Get logging status. .
status_reset/1 | #### Reset logging status. .
stdout_set/1 | #### Change the stdout output state. .
syslog_set/1 | #### Change the syslog configuration. .
terminate/2 |
trace/8 | #### Trace log message. which reports subsystem data that is only for tracing execution.
warn/8 | #### Warning log message. which indicates an unexpected occurance was found in a subsystem.

## Function Details

### code_change/3

`code_change(X1, State, X3) -> any()`

### datetime_to_string/1

`datetime_to_string(DateTimeUTC::calendar:datetime()) -> cloudi_timestamp:iso8601_seconds()`

#### Create an ISO8601 timestamp from a datetime in UTC.

### debug/8

`debug(ModeInterface::mode_interface(), Process::atom() | {atom(), node()}, Module::atom(), Line::non_neg_integer(), Function::atom(), Arity::arity() | undefined, Format::string(), Args::list() | undefined) -> ok`

#### Debug log message.

which reports subsystem data that should be useful for debugging. Called with ?LOG_DEBUG(Format, []).

### error/8

`error(ModeInterface::mode_interface(), Process::atom() | {atom(), node()}, Module::atom(), Line::non_neg_integer(), Function::atom(), Arity::arity() | undefined, Format::string(), Args::list() | undefined) -> ok`

#### Error log message.

which indicates a subsystem has failed but the failure is not fatal. Called with ?LOG_ERROR(Format, []).

### fatal/8

`fatal(ModeInterface::mode_interface(), Process::atom() | {atom(), node()}, Module::atom(), Line::non_neg_integer(), Function::atom(), Arity::arity() | undefined, Format::string(), Args::list() | undefined) -> ok`

#### Critical log message.

which indicates the system has failed and can not continue. Called with ?LOG_FATAL(Format, []).

### file_set/1

`file_set(FilePath::string() | undefined) -> ok | {error, file:posix() | badarg | system_limit}`

#### Change the file output path.

### format/2

`format(Msg, Config) -> any()`

#### Lager formatter example with default output.

### format/3

`format(Msg::{lager_msg, Destinations::list(), Metadata::[{atom(), any()}], Severity::debug | emergency | error | info | warning, Datetime::{string(), string()}, Timestamp::erlang:timestamp(), Message::list()}, Config::list(), Colors::any()) -> iolist()`

#### Lager formatter example with default output.

### formatters_set/1

`formatters_set(FormattersConfig::#config_logging_formatters{default = undefined | #config_logging_formatter{level = cloudi_service_api:loglevel(), output = undefined | module(), output_name = atom(), output_args = list(), output_max_r = non_neg_integer(), output_max_t = cloudi_service_api:seconds(), formatter = undefined | module(), formatter_config = list()}, lookup = keys1value:keys1value(module(), #config_logging_formatter{level = cloudi_service_api:loglevel(), output = undefined | module(), output_name = atom(), output_args = list(), output_max_r = non_neg_integer(), output_max_t = cloudi_service_api:seconds(), formatter = undefined | module(), formatter_config = list()}), level = undefined | cloudi_service_api:loglevel()} | undefined) -> ok`

#### Change the logging formatters.

### handle_call/3

`handle_call(Request, X2, State) -> any()`

### handle_cast/2

`handle_cast(Request, State) -> any()`

### handle_info/2

`handle_info(Terminate, State) -> any()`

### info/8

`info(ModeInterface::mode_interface(), Process::atom() | {atom(), node()}, Module::atom(), Line::non_neg_integer(), Function::atom(), Arity::arity() | undefined, Format::string(), Args::list() | undefined) -> ok`

#### Info log message.

which indicates a subsystem has changed state. Called with ?LOG_INFO(Format, []).

### init/1

`init(X1) -> any()`

### level_set/1

`level_set(Level::cloudi_service_api:loglevel() | undefined) -> ok`

#### Change the file output log level.

### metadata_get/0

`metadata_get() -> [{atom(), any()}] | #{}`

#### Get metadata.

### metadata_set/1

`metadata_set(L::[{atom(), any()}] | #{}) -> ok`

#### Set metadata.

### microseconds_to_string/1

`microseconds_to_string(TotalMicroSeconds::non_neg_integer()) -> cloudi_timestamp:iso8601()`

#### Create an ISO8601 timestamp from microseconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00.000000Z)

### milliseconds_to_string/1

`milliseconds_to_string(TotalMilliSeconds::non_neg_integer()) -> cloudi_timestamp:iso8601()`

#### Create an ISO8601 timestamp from milliseconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00.000Z)

### redirect_set/1

`redirect_set(Node::atom()) -> ok`

#### Redirect this node's logging to a different node.

### redirect_update/1

`redirect_update(Node::atom()) -> ok`

#### Update the destination of logging output.

### seconds_to_string/1

`seconds_to_string(TotalSeconds::non_neg_integer()) -> cloudi_timestamp:iso8601_seconds()`

#### Create an ISO8601 timestamp from seconds since the UNIX epoch.

(The UNIX epoch is 1970-01-01T00:00:00Z)

### set/1

`set(LoggingConfig::#config_logging{file = undefined | string(), stdout = boolean(), level = undefined | cloudi_service_api:loglevel(), queue_mode_async = pos_integer(), queue_mode_sync = pos_integer(), queue_mode_overload = pos_integer(), redirect = undefined | node(), syslog = undefined | #config_logging_syslog{identity = cloudi_service_api:logging_syslog_identity(), facility = cloudi_service_api:logging_syslog_facility(), level = cloudi_service_api:loglevel(), transport = cloudi_service_api:logging_syslog_transport(), transport_options = cloudi_service_api:logging_syslog_transport_options(), protocol = cloudi_service_api:logging_syslog_protocol(), path = cloudi_service_api:logging_syslog_path(), host = cloudi_service_api:logging_syslog_host(), port = cloudi_service_api:logging_syslog_port()}, formatters = undefined | #config_logging_formatters{default = undefined | #config_logging_formatter{level = cloudi_service_api:loglevel(), output = undefined | module(), output_name = atom(), output_args = list(), output_max_r = non_neg_integer(), output_max_t = cloudi_service_api:seconds(), formatter = undefined | module(), formatter_config = list()}, lookup = keys1value:keys1value(module(), #config_logging_formatter{level = cloudi_service_api:loglevel(), output = undefined | module(), output_name = atom(), output_args = list(), output_max_r = non_neg_integer(), output_max_t = cloudi_service_api:seconds(), formatter = undefined | module(), formatter_config = list()}), level = undefined | cloudi_service_api:loglevel()}, log_time_offset = cloudi_service_api:loglevel(), aspects_log_before = [cloudi_service_api:aspect_log_before()], aspects_log_after = [cloudi_service_api:aspect_log_after()]}) -> ok | {error, file:posix() | badarg | system_limit}`

#### Change the logging configuration.

### start_link/1

`start_link(Config::#config{uuid_generator = uuid:state(), code = #config_code{paths = [string()], modules = [module()], applications = [atom()], releases = [string()]}, logging = #config_logging{file = undefined | string(), stdout = boolean(), level = undefined | cloudi_service_api:loglevel(), queue_mode_async = pos_integer(), queue_mode_sync = pos_integer(), queue_mode_overload = pos_integer(), redirect = undefined | node(), syslog = undefined | #config_logging_syslog{identity = cloudi_service_api:logging_syslog_identity(), facility = cloudi_service_api:logging_syslog_facility(), level = cloudi_service_api:loglevel(), transport = cloudi_service_api:logging_syslog_transport(), transport_options = cloudi_service_api:logging_syslog_transport_options(), protocol = cloudi_service_api:logging_syslog_protocol(), path = cloudi_service_api:logging_syslog_path(), host = cloudi_service_api:logging_syslog_host(), port = cloudi_service_api:logging_syslog_port()}, formatters = undefined | #config_logging_formatters{default = undefined | #config_logging_formatter{level = cloudi_service_api:loglevel(), output = undefined | module(), output_name = atom(), output_args = list(), output_max_r = non_neg_integer(), output_max_t = cloudi_service_api:seconds(), formatter = undefined | module(), formatter_config = list()}, lookup = keys1value:keys1value(module(), #config_logging_formatter{level = cloudi_service_api:loglevel(), output = undefined | module(), output_name = atom(), output_args = list(), output_max_r = non_neg_integer(), output_max_t = cloudi_service_api:seconds(), formatter = undefined | module(), formatter_config = list()}), level = undefined | cloudi_service_api:loglevel()}, log_time_offset = cloudi_service_api:loglevel(), aspects_log_before = [cloudi_service_api:aspect_log_before()], aspects_log_after = [cloudi_service_api:aspect_log_after()]}, acl = #{atom() := [cloudi:service_name_pattern(), ...]}, services = [#config_service_internal{prefix = string(), module = atom() | cloudi_service_api:file_path(), file_path = undefined | cloudi_service_api:file_path(), args = list(), dest_refresh = cloudi_service_api:dest_refresh(), timeout_init = cloudi_service_api:timeout_initialize_value_milliseconds(), timeout_async = cloudi_service_api:timeout_send_async_value_milliseconds(), timeout_sync = cloudi_service_api:timeout_send_sync_value_milliseconds(), timeout_term = cloudi_service_api:timeout_terminate_value_milliseconds(), dest_list_deny = cloudi_service_api:dest_list(), dest_list_allow = cloudi_service_api:dest_list(), count_process = pos_integer(), max_r = non_neg_integer(), max_t = cloudi_service_api:seconds(), options = #config_service_options{priority_default = cloudi_service:priority(), queue_limit = undefined | non_neg_integer(), queue_size = undefined | pos_integer(), rate_request_max = undefined | number() | [{period, cloudi_service_api:period_seconds()} | {value, number()}] | tuple(), dest_refresh_start = cloudi_service_api:dest_refresh_delay_milliseconds(), dest_refresh_delay = cloudi_service_api:dest_refresh_delay_milliseconds(), request_name_lookup = sync | async, request_timeout_adjustment = boolean(), request_timeout_immediate_max = cloudi_service_api:request_timeout_immediate_max_milliseconds(), response_timeout_adjustment = boolean(), response_timeout_immediate_max = cloudi_service_api:response_timeout_immediate_max_milliseconds(), count_process_dynamic = false | [{period, cloudi_service_api:period_seconds()} | {rate_request_max, number()} | {rate_request_min, number()} | {count_max, number()} | {count_min, number()}] | tuple(), timeout_terminate = undefined | cloudi_service_api:timeout_terminate_milliseconds(), restart_all = boolean(), restart_delay = [{time_exponential_min, cloudi_service_api:restart_delay_milliseconds()} | {time_exponential_max, cloudi_service_api:restart_delay_milliseconds()} | {time_absolute, cloudi_service_api:restart_delay_milliseconds()}] | false | tuple(), scope = atom(), monkey_latency = [{time_uniform_min, cloudi_service_api:latency_min_time_milliseconds()} | {time_uniform_max, cloudi_service_api:latency_max_time_milliseconds()} | {time_gaussian_mean, cloudi_service_api:latency_mean_time_milliseconds()} | {time_gaussian_stddev, float() | pos_integer()} | {time_absolute, cloudi_service_api:latency_time_milliseconds()}] | system | false | tuple(), monkey_chaos = [{probability_request, float()} | {probability_day, float()}] | system | false | tuple(), automatic_loading = boolean(), dispatcher_pid_options = [link | {priority, low | normal | high} | {fullsweep_after, non_neg_integer()} | {min_heap_size, non_neg_integer()} | {min_bin_vheap_size, non_neg_integer()} | {max_heap_size, cloudi_service_api:max_heap_size_options()} | {sensitive, boolean()} | {message_queue_data, off_heap | on_heap}], aspects_init_after = [cloudi_service_api:aspect_init_after_internal() | cloudi_service_api:aspect_init_after_external()], aspects_request_before = [cloudi_service_api:aspect_request_before_internal() | cloudi_service_api:aspect_request_before_external()], aspects_request_after = [cloudi_service_api:aspect_request_after_internal() | cloudi_service_api:aspect_request_after_external()], aspects_info_before = [cloudi_service_api:aspect_info_before_internal()], aspects_info_after = [cloudi_service_api:aspect_info_after_internal()], aspects_terminate_before = [cloudi_service_api:aspect_terminate_before_internal() | cloudi_service_api:aspect_terminate_before_external()], aspects_suspend = [cloudi_service_api:aspect_suspend()], aspects_resume = [cloudi_service_api:aspect_resume()], limit = cloudi_service_api:limit_external(), owner = cloudi_service_api:owner_external(), nice = cloudi_service_api:nice_external(), cgroup = cloudi_service_api:cgroup_external(), chroot = cloudi_service_api:chroot_external(), syscall_lock = cloudi_service_api:syscall_lock_external(), directory = cloudi_service_api:directory_external(), application_name = atom(), init_pid_options = [link | {priority, low | normal | high} | {fullsweep_after, non_neg_integer()} | {min_heap_size, non_neg_integer()} | {min_bin_vheap_size, non_neg_integer()} | {max_heap_size, cloudi_service_api:max_heap_size_options()} | {sensitive, boolean()} | {message_queue_data, off_heap | on_heap}], request_pid_uses = infinity | pos_integer(), request_pid_options = [link | {priority, low | normal | high} | {fullsweep_after, non_neg_integer()} | {min_heap_size, non_neg_integer()} | {min_bin_vheap_size, non_neg_integer()} | {max_heap_size, cloudi_service_api:max_heap_size_options()} | {sensitive, boolean()} | {message_queue_data, off_heap | on_heap}], info_pid_uses = infinity | pos_integer(), info_pid_options = [link | {priority, low | normal | high} | {fullsweep_after, non_neg_integer()} | {min_heap_size, non_neg_integer()} | {min_bin_vheap_size, non_neg_integer()} | {max_heap_size, cloudi_service_api:max_heap_size_options()} | {sensitive, boolean()} | {message_queue_data, off_heap | on_heap}], duo_mode = boolean(), hibernate = boolean() | [{period, cloudi_service_api:period_seconds()} | {rate_request_min, number()}] | tuple(), reload = boolean()}, uuid = cloudi_service_api:service_id()} | #config_service_external{prefix = string(), file_path = cloudi_service_api:file_path(), args = string(), env = [{string(), string()}], dest_refresh = cloudi_service_api:dest_refresh(), protocol = local | tcp | udp, buffer_size = pos_integer(), timeout_init = cloudi_service_api:timeout_initialize_value_milliseconds(), timeout_async = cloudi_service_api:timeout_send_async_value_milliseconds(), timeout_sync = cloudi_service_api:timeout_send_sync_value_milliseconds(), timeout_term = cloudi_service_api:timeout_terminate_value_milliseconds(), dest_list_deny = cloudi_service_api:dest_list(), dest_list_allow = cloudi_service_api:dest_list(), count_process = pos_integer(), count_thread = pos_integer(), max_r = non_neg_integer(), max_t = cloudi_service_api:seconds(), options = #config_service_options{priority_default = cloudi_service:priority(), queue_limit = undefined | non_neg_integer(), queue_size = undefined | pos_integer(), rate_request_max = undefined | number() | [{period, cloudi_service_api:period_seconds()} | {value, number()}] | tuple(), dest_refresh_start = cloudi_service_api:dest_refresh_delay_milliseconds(), dest_refresh_delay = cloudi_service_api:dest_refresh_delay_milliseconds(), request_name_lookup = sync | async, request_timeout_adjustment = boolean(), request_timeout_immediate_max = cloudi_service_api:request_timeout_immediate_max_milliseconds(), response_timeout_adjustment = boolean(), response_timeout_immediate_max = cloudi_service_api:response_timeout_immediate_max_milliseconds(), count_process_dynamic = false | [{period, cloudi_service_api:period_seconds()} | {rate_request_max, number()} | {rate_request_min, number()} | {count_max, number()} | {count_min, number()}] | tuple(), timeout_terminate = undefined | cloudi_service_api:timeout_terminate_milliseconds(), restart_all = boolean(), restart_delay = [{time_exponential_min, cloudi_service_api:restart_delay_milliseconds()} | {time_exponential_max, cloudi_service_api:restart_delay_milliseconds()} | {time_absolute, cloudi_service_api:restart_delay_milliseconds()}] | false | tuple(), scope = atom(), monkey_latency = [{time_uniform_min, cloudi_service_api:latency_min_time_milliseconds()} | {time_uniform_max, cloudi_service_api:latency_max_time_milliseconds()} | {time_gaussian_mean, cloudi_service_api:latency_mean_time_milliseconds()} | {time_gaussian_stddev, float() | pos_integer()} | {time_absolute, cloudi_service_api:latency_time_milliseconds()}] | system | false | tuple(), monkey_chaos = [{probability_request, float()} | {probability_day, float()}] | system | false | tuple(), automatic_loading = boolean(), dispatcher_pid_options = [link | {priority, low | normal | high} | {fullsweep_after, non_neg_integer()} | {min_heap_size, non_neg_integer()} | {min_bin_vheap_size, non_neg_integer()} | {max_heap_size, cloudi_service_api:max_heap_size_options()} | {sensitive, boolean()} | {message_queue_data, off_heap | on_heap}], aspects_init_after = [cloudi_service_api:aspect_init_after_internal() | cloudi_service_api:aspect_init_after_external()], aspects_request_before = [cloudi_service_api:aspect_request_before_internal() | cloudi_service_api:aspect_request_before_external()], aspects_request_after = [cloudi_service_api:aspect_request_after_internal() | cloudi_service_api:aspect_request_after_external()], aspects_info_before = [cloudi_service_api:aspect_info_before_internal()], aspects_info_after = [cloudi_service_api:aspect_info_after_internal()], aspects_terminate_before = [cloudi_service_api:aspect_terminate_before_internal() | cloudi_service_api:aspect_terminate_before_external()], aspects_suspend = [cloudi_service_api:aspect_suspend()], aspects_resume = [cloudi_service_api:aspect_resume()], limit = cloudi_service_api:limit_external(), owner = cloudi_service_api:owner_external(), nice = cloudi_service_api:nice_external(), cgroup = cloudi_service_api:cgroup_external(), chroot = cloudi_service_api:chroot_external(), syscall_lock = cloudi_service_api:syscall_lock_external(), directory = cloudi_service_api:directory_external(), application_name = atom(), init_pid_options = [link | {priority, low | normal | high} | {fullsweep_after, non_neg_integer()} | {min_heap_size, non_neg_integer()} | {min_bin_vheap_size, non_neg_integer()} | {max_heap_size, cloudi_service_api:max_heap_size_options()} | {sensitive, boolean()} | {message_queue_data, off_heap | on_heap}], request_pid_uses = infinity | pos_integer(), request_pid_options = [link | {priority, low | normal | high} | {fullsweep_after, non_neg_integer()} | {min_heap_size, non_neg_integer()} | {min_bin_vheap_size, non_neg_integer()} | {max_heap_size, cloudi_service_api:max_heap_size_options()} | {sensitive, boolean()} | {message_queue_data, off_heap | on_heap}], info_pid_uses = infinity | pos_integer(), info_pid_options = [link | {priority, low | normal | high} | {fullsweep_after, non_neg_integer()} | {min_heap_size, non_neg_integer()} | {min_bin_vheap_size, non_neg_integer()} | {max_heap_size, cloudi_service_api:max_heap_size_options()} | {sensitive, boolean()} | {message_queue_data, off_heap | on_heap}], duo_mode = boolean(), hibernate = boolean() | [{period, cloudi_service_api:period_seconds()} | {rate_request_min, number()}] | tuple(), reload = boolean()}, uuid = cloudi_service_api:service_id()}], nodes = #config_nodes{nodes = [node()], reconnect_start = cloudi_service_api:node_reconnect_delay_seconds(), reconnect_delay = cloudi_service_api:node_reconnect_delay_seconds(), listen = visible | all, connect = visible | hidden, timestamp_type = erlang | os | warp, discovery = #config_nodes_discovery{mode = multicast | ec2, module = module(), start_f = atom(), start_a = list(), discover_f = atom(), discover_a = list(), stop_f = atom(), stop_a = list()} | undefined, cost = [{node() | default, float()}], cost_precision = 0..253, log_reconnect = cloudi_service_api:loglevel()}}) -> {ok, pid()} | {error, any()}`

#### Start the logging server with the supplied configuration.

### status/1

`status(Timeout::pos_integer() | infinity) -> {ok, cloudi_service_api:logging_status()} | {error, timeout | noproc}`

#### Get logging status.

### status_reset/1

`status_reset(Timeout::pos_integer() | infinity) -> ok | {error, timeout | noproc}`

#### Reset logging status.

### stdout_set/1

`stdout_set(Stdout::boolean()) -> ok`

#### Change the stdout output state.

### syslog_set/1

`syslog_set(SyslogConfig::#config_logging_syslog{identity = cloudi_service_api:logging_syslog_identity(), facility = cloudi_service_api:logging_syslog_facility(), level = cloudi_service_api:loglevel(), transport = cloudi_service_api:logging_syslog_transport(), transport_options = cloudi_service_api:logging_syslog_transport_options(), protocol = cloudi_service_api:logging_syslog_protocol(), path = cloudi_service_api:logging_syslog_path(), host = cloudi_service_api:logging_syslog_host(), port = cloudi_service_api:logging_syslog_port()} | undefined) -> ok`

#### Change the syslog configuration.

### terminate/2

`terminate(X1, State) -> any()`

### trace/8

`trace(ModeInterface::mode_interface(), Process::atom() | {atom(), node()}, Module::atom(), Line::non_neg_integer(), Function::atom(), Arity::arity() | undefined, Format::string(), Args::list() | undefined) -> ok`

#### Trace log message.

which reports subsystem data that is only for tracing execution. Called with ?LOG_TRACE(Format, []).

### warn/8

`warn(ModeInterface::mode_interface(), Process::atom() | {atom(), node()}, Module::atom(), Line::non_neg_integer(), Function::atom(), Arity::arity() | undefined, Format::string(), Args::list() | undefined) -> ok`

#### Warning log message.

which indicates an unexpected occurance was found in a subsystem. Called with ?LOG_WARN(Format, []).

Generated by EDoc