diff options
author | Damien F. Katz <damien@apache.org> | 2008-04-20 18:17:15 +0000 |
---|---|---|
committer | Damien F. Katz <damien@apache.org> | 2008-04-20 18:17:15 +0000 |
commit | fb5b6bbc5aa941478d700e8fb3011c2a24c4d2d4 (patch) | |
tree | bcc23ed4869f395e894f76ec3fb5e76f75a5ba98 /src/couchdb/couch_log.erl | |
parent | ad230e67fb09883e2171291d5a42635f5e2addb9 (diff) |
Added proper UUID generation and changed the details of how way debug logging is done to now use a more effcient macro instead of a function call.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@649948 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_log.erl')
-rw-r--r-- | src/couchdb/couch_log.erl | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/src/couchdb/couch_log.erl b/src/couchdb/couch_log.erl index 47e0114d..95ddc47f 100644 --- a/src/couchdb/couch_log.erl +++ b/src/couchdb/couch_log.erl @@ -14,7 +14,7 @@ -behaviour(gen_event). -export([start_link/2,stop/0]). --export([error/1,error/2,info/1,info/2,debug/1,debug/2,get_level/0,get_level_integer/0, set_level/1]). +-export([debug_on/0,info_on/0,get_level/0,get_level_integer/0, set_level/1]). -export([init/1, handle_event/2, terminate/2, code_change/3, handle_info/2, handle_call/2]). -define(LEVEL_ERROR, 3). @@ -44,33 +44,11 @@ init({Filename, Level}) -> {ok, Fd} = file:open(Filename, [append]), {ok, {Fd, level_integer(Level)}}. -error(Msg) -> - error("~s", [Msg]). - -error(Format, Args) -> - error_logger:error_report(couch_error, {Format, Args}). - -info(Msg) -> - info("~s", [Msg]). - -info(Format, Args) -> - case get_level_integer() =< ?LEVEL_INFO of - true -> - error_logger:info_report(couch_info, {Format, Args}); - false -> - ok - end. - -debug(Msg) -> - debug("~s", [Msg]). - -debug(Format, Args) -> - case get_level_integer() =< ?LEVEL_DEBUG of - true -> - error_logger:info_report(couch_debug, {Format, Args}); - false -> - ok - end. +debug_on() -> + get_level_integer() =< ?LEVEL_DEBUG. + +info_on() -> + get_level_integer() =< ?LEVEL_INFO. set_level(LevelAtom) -> set_level_integer(level_integer(LevelAtom)). |