-module(aws@internal@log). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/aws/internal/log.gleam"). -export([debug/1, warning/1, error/1]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC( " Leveled logging for the SDK runtime.\n" "\n" " Quiet by default, a firehose on demand (see `PHILOSOPHY.md` and the\n" " `Logging` section of `RULES.md`). The SDK says nothing on the happy\n" " path and only what an operator must see when something fails; turn the\n" " logger up to `debug` and it narrates both paths in full.\n" "\n" " This is a thin pass-through to OTP `logger` (via `aws_log_ffi`) — the\n" " idiomatic BEAM mechanism, mirroring how the AWS Rust SDK leaves the sink\n" " to the application. There is no SDK-specific level knob: the operator\n" " configures verbosity and destination the standard way.\n" "\n" " - Levels — the logger's primary level gates everything. It defaults to\n" " `notice`, under which `error` and `warning` are shown and `debug` is\n" " hidden. Turn on the firehose with, e.g.,\n" " `logger:set_primary_config(level, debug)` or a `kernel` `sys.config`\n" " entry. (Per-module control via `logger:set_module_level/2` also works\n" " — SDK events are emitted from the `aws_log_ffi` module.)\n" " - Destination — the logger's handler decides. The default handler writes\n" " to standard_io (stdout); point it elsewhere (e.g. `standard_error`) via\n" " the handler config if you prefer. The SDK installs no handler of its\n" " own, so its lines pick up the host's formatter and routing.\n" ). -file("src/aws/internal/log.gleam", 27). ?DOC( " Log at `debug` — the firehose, off unless the logger level is `debug`.\n" " The message is a thunk so its (often expensive) construction is skipped\n" " entirely when debug is not enabled.\n" ). -spec debug(fun(() -> binary())) -> nil. debug(Message) -> aws_log_ffi:emit_debug(Message). -file("src/aws/internal/log.gleam", 33). ?DOC( " Log at `warning` — notable but recovered (a retry fired, a credential\n" " provider was configured but failed). On by default (outranks `notice`).\n" ). -spec warning(binary()) -> nil. warning(Message) -> aws_log_ffi:emit_warning(Message). -file("src/aws/internal/log.gleam", 40). ?DOC( " Log at `error` — unrecoverable, operator-must-see (credential chain\n" " exhausted, retries exhausted, the Lambda Runtime API gone fatal). Sparse,\n" " and on by default (outranks `notice`).\n" ). -spec error(binary()) -> nil. error(Message) -> aws_log_ffi:emit_error(Message).