aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/logger.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2018-08-15 09:30:56 +0200
committerGitHub <[email protected]>2018-08-15 09:30:56 +0200
commit0aae9b681d724314584140018298a5ff9d0e6fc1 (patch)
tree18afd95f6af28e54257efc18ea4501048605ff40 /lib/kernel/src/logger.erl
parentd29d81dbdaa2f4f0588c45baf7ad7c4746de0b4c (diff)
parentf49f2d060e43953c4f09e604ee2b98db33867089 (diff)
downloadotp-0aae9b681d724314584140018298a5ff9d0e6fc1.tar.gz
otp-0aae9b681d724314584140018298a5ff9d0e6fc1.tar.bz2
otp-0aae9b681d724314584140018298a5ff9d0e6fc1.zip
lukas/kernel/logger_set_app_lvl/PR-1843/OTP-15146
Add logger:set_application_level/2
Diffstat (limited to 'lib/kernel/src/logger.erl')
-rw-r--r--lib/kernel/src/logger.erl22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/kernel/src/logger.erl b/lib/kernel/src/logger.erl
index ffc90f4fc5..0020fe220b 100644
--- a/lib/kernel/src/logger.erl
+++ b/lib/kernel/src/logger.erl
@@ -39,6 +39,7 @@
remove_primary_filter/1, remove_handler_filter/2,
set_module_level/2,
unset_module_level/1, unset_module_level/0,
+ set_application_level/2, unset_application_level/1,
get_module_level/0, get_module_level/1,
set_primary_config/1, set_primary_config/2,
set_handler_config/2, set_handler_config/3,
@@ -488,6 +489,27 @@ unset_module_level(Modules) ->
unset_module_level() ->
logger_server:unset_module_level().
+-spec set_application_level(Application,Level) -> ok | {error, not_loaded} when
+ Application :: atom(),
+ Level :: level() | all | none.
+set_application_level(App,Level) ->
+ case application:get_key(App, modules) of
+ {ok, Modules} ->
+ set_module_level(Modules, Level);
+ undefined ->
+ {error, {not_loaded, App}}
+ end.
+
+-spec unset_application_level(Application) -> ok | {error, not_loaded} when
+ Application :: atom().
+unset_application_level(App) ->
+ case application:get_key(App, modules) of
+ {ok, Modules} ->
+ unset_module_level(Modules);
+ undefined ->
+ {error, {not_loaded, App}}
+ end.
+
-spec get_module_level(Modules) -> [{Module,Level}] when
Modules :: [Module] | Module,
Module :: module(),