[erlang-questions] Lager trace_file filter

Andrew Thompson <>
Mon Feb 4 06:41:53 CET 2013


On Sun, Feb 03, 2013 at 11:36:35PM +0100, Janos Hary wrote:
> Is there a way to specify 'orelse' relation between lager:trace_file
> filters?
> 
>  
> 
> For example I'd like to allow trace messages coming only from module mod1
> and mod2:
> 
> lager:trace_file("log/trace.log", [{module, mod1}, {module, mod2}])
> 
> but it doesn't work.

Unfortunately, there is not. To be fast, trace filters need to be able
to 'fail fast' and discard messages they can not possibly match. Thus, I
decided that 'orelse' expressions would, at least initially, not be
allowed.

I'm open to suggestions on making 'orelse' expressions cheap enough to
test that we can still fail fast when matching messages.

Also, this doesn't implement or, but DeadZen has added some comparator
support to lager tracing, which I hope to be able to integrate to master
soon:

https://github.com/DeadZen/lager/tree/dz-lager-stream

Andrew



More information about the erlang-questions mailing list