Coder Social home page Coder Social logo

alogger's Issues

log_lazy in alog_if.

New function is the same as alog_if:log/8.

But check every argument for fun().
Fun should be executed.

SMTP logger

One should have an ability to send messages to email.

Eliminating "tuple expression" overhead

For now, alog_pt makes following:
?DBG({A, B, "test ~p"}, [foobar]) → dbg(io_lib:format("A: ~p B: ~p ~s", [A, B, "test ~p"]), [foobar])
There is another way to do this with less overhead:
?DBG({A, B, "test ~p"}, [foobar]) → dbg("A: ~p B: ~p test ~p", [A, B, foobar])

New macro API

2 forms — full ?DBG("~p ~p", [Foo, Bar]) and short ?DBG({Foo, Bar})
second one can be taken as first one with automagically formed format string
every arg can be replaced with {lazy, Fun} — in this case alog_if:log_lazy is called instead of alog_if:log, or with {lazy, "Name", Fun} (in this case Name will be used as a name of resulting value in tuple expression)
new form: ?DBG(["foobar", ARBITRARY_EXPRESSION])
new macro: ?DBG_TC() that measures time of execution of list-expr and lazy funs

Add an interface to gen_alogger for reconfiguration

It would be useful to have a possibility to reconfigure a log interface run time, so I propose to add reconfigure/1 function to gen_alogger behaviour to let a user do this. Also, it probably needs to add a function for restart a log interface, like restart/0, but I'll think about it more.

Application with alloger stop on alog_sup with Erlang R16

My application use alogger with the example configuration (tty + syslog).

On Erlang R15B3-1 all works fine.
On Erlang R16B1 and R16B2 it stops on start when alog_sup starting. No information passed to syslog, erlang console also unacceptable.

Single syslog application works fine:
1> application:start(syslog).
ok
3> {ok, S} = syslog:open("test", [cons, perror, pid], user).
{ok,#Port<0.754>}
4> syslog:log(S, 1, "qwe123").
ok

But there are some warning in syslog compillation process:
Compiling c_src/syslog_drv.c
c_src/syslog_drv.c: In function ‘syslogdrv_control’:
c_src/syslog_drv.c:187:13: warning: ‘driver_output_term’ is deprecated (declared at /home/mkrentovskiy/erlang/r16/erts-5.10.3/include/erl_driver.h:622) [-Wdeprecated-declarations]
driver_output_term(port, term, sizeof term/sizeof *term);
^

Repeating reports in error logger backend.

Steps to reproduce:

  1. Turn on error logger handler in config.
  2. Make report.
(alog_dev@maxubuntu)2> error_logger:error_report("some data").         
2013-10-10 16:43:05.499597 =STD ERROR=======
Unknown report: "some data"
=ERROR REPORT==== 10-Oct-2013::16:43:05 ===
some data
ok

Add an ability to have several loggers from the same alog_* module

I need to write different log levels messages in different log files. What should I do?
It'ill be nice to use something like this:

[
    {alog, [
            {enabled_loggers,[alog_disk_log1,alog_disk_log2,alog_disk_log3]},
            {install_error_logger_handler, true},
            {flows, [
                {{mod, ['_']}, {'=<', debug}, [alog_disk_log1]},
                {{mod, ['_']}, {'=<', warning}, [alog_disk_log2]},
                {{mod, [alog_examples]}, {'=<', debug}, [alog_disk_log3]}
            ]},
            {alog_disk_log1, [
                {module, alog_disk_log},
                {name, alog_disk_log1},
                {file, "priv/logs/alog_disk_log1.log"},
                {format, external}
            ]},
            {alog_disk_log2, [
                {module, alog_disk_log},
                {name, alog_disk_log2},
                {file, "priv/logs/alog_disk_log2.log"},
                {format, external}
            ]}
            {alog_disk_log3, [
                {module, alog_disk_log},
                {name, alog_disk_log3},
                {file, "priv/logs/alog_disk_log2.log"},
                {format, external}
            ]}
    ]}
].

Is there way to do this with current version of alogger?

Update documentation

The documentation isn't up to date, so it needs to be update to reflect all the latest code changes.

error_logger handler loses time stamps

For some reason our error_logger handler loses time stamps, so, the original log entry looks like this:

=ERROR REPORT==== 7-Aug-2011::22:44:50 ===
Error in process <0.65.0> on node 'alog_dev@skull' with exit value: {{badmatch,32},[{erl_eval,expr,3}]}

the log entry by our handler looks like this:

=ERROR REPORT=======
Error in process <0.65.0> on node 'alog_dev@skull' with exit value: {{badmatch,32},[{erl_eval,expr,3}]}

probably the problem is with header "formatting".

Fix edawn

  1. it should escape > and < in
  2. it should not write "short description"
  3. it should react to package settings

several flows with {mod,['_']} filter

does not work as expected:

flows
id filter priority loggers enabled


2   {mod,['_']}   {'=<',debug}   [alog_disk_log]      true
1   {mod,['_']}   {'=<',debug}        [alog_tty]      true

sometimes the 'newline' character is lost

so, basically we get badly formatted logs like:

=PROGRESS REPORT=======
          supervisor: {local,wpart}
             started: [{pid,<0.356.0>},
                       {name,e_socat},
                       {mfargs,{e_socat,start_link,[[]]}},
                       {restart_type,permanent},
                       {shutdown,2000},
                       {child_type,worker}]=PROGRESS REPORT=======
         application: e_socat
          started_at: erlweb@eva=PROGRESS REPORT=======
exec: 1:           supervisor: {local,wpart}
             started: [{pid,<0.358.0>},
/home/ingham/src/userver/trunk/erlangweb/rel/lib/e_socat-1.0/priv/esocat.pl: Permission denied                       {name,e_olup_timer},

                       {mfargs,{e_olup_timer,start_link,[[]]}},
                       {restart_type,permanent},
                       {shutdown,2000},
                       {child_type,worker}]=PROGRESS REPORT=======
         application: e_olup_timer
          started_at: erlweb@evaruntime:0:debug [<0.88.0>]->[]: "EUMSChatServer start!!!" 
=PROGRESS REPORT=======
          supervisor: {local,wpart}
             started: [{pid,<0.361.0>},
                       {name,e_umschatserver},
                       {mfargs,{e_umschatserver,start_link,[[]]}},
                       {restart_type,permanent},
                       {shutdown,2000},
                       {child_type,worker}]=PROGRESS REPORT=======
         application: e_umschatserver
          started_at: erlweb@evaruntime:0:debug [<0.88.0>]->[]: "GUID server start" 
runtime:0:debug [<0.358.0>]->[]: "OLUP timer job error: " {badmatch,
                             {aborted,{no_exists,{videomail,disc_copies}}}} 

it's needed to double check all the places we format a log message.

Problem with SASL reports being intercepted by default

yrashk> si14: I just spent over 6 hours fighting with a problem that was sneaked in by alog :-(
yrashk> si14: I didn't know about install_error_logger_handler being true by default
yrashk> si14: so I was thinking SASL disrespects its config passed through sys.config
yrashk> si14: that was a horrible experience :-(
yrashk> si14: write about it in BIG LETTERS in the readme file
yrashk> and may be false by default
yrashk> I really spent almost a work day fighting this problem until I traced it down
yrashk> because your logs looked exactly like SASL's
yrashk> and I thought it is SASL printing them

Possible fixes (one or more should be applied):
-make this behaviour be false by default
-make SASL reports look different
-document this

http interface

Http interface would be a nice addition to alooger, so it could communicate with non-erlang processes (.NET ones for example).

Naming of macros

I noticed a inconsistency of the macro namings all macros have written out names only debug has a abbreviation it would make more sense or at least be more constistant to name DBG also DEBUG in my eyes.

Regards,
Heinz

Something for measuring time of execution

?DBG("Starting pwrite"),
StartPWrt = erlang:now(),
file:pwrite(State#state.dump_file, Acc),
?DBG("Done pwrite, time: ~p", [timer:now_diff(StartPWrt, erlang:now())]),

annoying. Should invent something to make it easier.

disk_log interface

It would be nice to have an interface towards disk_log logger. For the start, it would be good to have at least the basic functionality.

Formatter

To divide loggers and formatters.

New construction 'not' in rules

2   {mod,[controller_event]}   {'=<',error}   [alog_disk_log]      true
1                {mod,['_']}   {'=<',debug}   [alog_disk_log]      true

In this case controlller_event with priority 'debug' will be logged by '1' rule. It will be good to have construction 'not' to avoid that.

to make log messages flatten

Sometimes it could be very useful to have all the log messages flatten, it means that there're no any '\n' in a log message, so, the logs are very well "grep'able".

Zero-config easy start for new library users

Change library default configuration (when alog.config not found and no flows configured) so that it prints to alot_tty by default.

get rid of step 4 in:

  1. Add alog to deps in rebar and run rebar get-deps
  2. Add -include_lib( "alog/include/alog.hrl" ).
  3. Add application:start( alog ) (and SASL!)
  4. Configure proper flows or create config file and add to command line with erl -config priv/alog
  5. Try ?INFO("Hello world")

Makes learning curve easier for new users.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.