couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [2/4] couch-log commit: updated refs/heads/master to fd40b31
Date Fri, 18 Sep 2015 13:43:46 GMT
Add stderr logger implementation. Make it to fail-safe.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/commit/49741262
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/tree/49741262
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/diff/49741262

Branch: refs/heads/master
Commit: 49741262fc0402a0fe4b62893410ce19eb045f81
Parents: 6bb3501
Author: Eric Avdey <eiri@eiri.ca>
Authored: Thu Sep 17 18:03:02 2015 -0300
Committer: Eric Avdey <eiri@eiri.ca>
Committed: Thu Sep 17 19:05:20 2015 -0300

----------------------------------------------------------------------
 rebar.config             |  7 ------
 src/couch_log.app.src    |  3 ++-
 src/couch_log_stderr.erl | 57 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/blob/49741262/rebar.config
----------------------------------------------------------------------
diff --git a/rebar.config b/rebar.config
index dee56d4..e69de29 100644
--- a/rebar.config
+++ b/rebar.config
@@ -1,7 +0,0 @@
-{deps, [
-    {lager, ".*", {git, "https://git-wip-us.apache.org/repos/asf/couchdb-lager.git", {branch,
"master"}}}
-]}.
-
-{erl_opts, [debug_info, {parse_transform, lager_transform}]}.
-
-

http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/blob/49741262/src/couch_log.app.src
----------------------------------------------------------------------
diff --git a/src/couch_log.app.src b/src/couch_log.app.src
index f8372ca..b59b1e9 100644
--- a/src/couch_log.app.src
+++ b/src/couch_log.app.src
@@ -15,5 +15,6 @@
     {vsn, git},
     {modules, [couch_log]},
     {registered, []},
-    {applications, [kernel, stdlib, lager]}
+    {applications, [kernel, stdlib]},
+    {env, [{backend, couch_log_stderr}]}
 ]}.

http://git-wip-us.apache.org/repos/asf/couchdb-couch-log/blob/49741262/src/couch_log_stderr.erl
----------------------------------------------------------------------
diff --git a/src/couch_log_stderr.erl b/src/couch_log_stderr.erl
new file mode 100644
index 0000000..6bf95b9
--- /dev/null
+++ b/src/couch_log_stderr.erl
@@ -0,0 +1,57 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_log_stderr).
+
+-behaviour(couch_log).
+
+-export([
+    debug/2,
+    info/2,
+    notice/2,
+    warning/2,
+    error/2,
+    critical/2,
+    alert/2,
+    emergency/2,
+    set_level/1
+]).
+
+debug(Fmt, Args) ->
+    write_log("[debug] " ++ Fmt, Args).
+
+info(Fmt, Args) ->
+    write_log("[info] " ++ Fmt, Args).
+
+notice(Fmt, Args) ->
+    write_log("[notice] " ++ Fmt, Args).
+
+warning(Fmt, Args) ->
+    write_log("[warning] " ++ Fmt, Args).
+
+error(Fmt, Args) ->
+    write_log("[error] " ++ Fmt, Args).
+
+critical(Fmt, Args) ->
+    write_log("[critical] " ++ Fmt, Args).
+
+alert(Fmt, Args) ->
+    write_log("[alert] " ++ Fmt, Args).
+
+emergency(Fmt, Args) ->
+    write_log("[emergency] " ++ Fmt, Args).
+
+write_log(Fmt, Args) ->
+    io:format(standard_error, Fmt ++ "~n", Args).
+
+set_level(_) ->
+    ok.


Mime
View raw message