aboutsummaryrefslogtreecommitdiffstats
path: root/src/rcl_log.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rcl_log.erl')
-rw-r--r--src/rcl_log.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/rcl_log.erl b/src/rcl_log.erl
index a5fb43a..a24b1c0 100644
--- a/src/rcl_log.erl
+++ b/src/rcl_log.erl
@@ -36,6 +36,7 @@
format/1]).
-export_type([int_log_level/0,
+ atom_log_level/0,
log_level/0,
log_fun/0,
t/0]).
@@ -46,10 +47,14 @@
%% types
%%============================================================================
+-type log_level() :: int_log_level() | atom_log_level().
+
-type int_log_level() :: 0..2.
+
%% Why no warn? because for our purposes there is no difference between error
%% and warn
--type log_level() :: error | info | debug.
+-type atom_log_level() :: error | info | debug.
+
-opaque t() :: {?MODULE, int_log_level()}.
-type log_fun() :: fun(() -> iolist()).
@@ -58,7 +63,7 @@
%% API
%%============================================================================
%% @doc Create a new 'log level' for the system
--spec new(int_log_level() | log_level()) -> t().
+-spec new(log_level()) -> t().
new(LogLevel) when LogLevel >= 0, LogLevel =< 2 ->
{?MODULE, LogLevel};
new(AtomLogLevel)
@@ -152,7 +157,7 @@ log_level({?MODULE, DetailLogLevel}) ->
DetailLogLevel.
%% @doc get the current log level as an atom
--spec atom_log_level(t()) -> log_level().
+-spec atom_log_level(t()) -> atom_log_level().
atom_log_level({?MODULE, ?RCL_ERROR}) ->
error;
atom_log_level({?MODULE, ?RCL_INFO}) ->