View Source FluentdForwarder.Handler behaviour (FluentdForwarder v0.1.0)
The FluentdForwarder.Handler
specification.
A Fluentd forward handler is a module that must export:
- a
c:call/2
function. - an
c:init/1
function which takes a set of options and initializes it.
The result returned by c:init/1
is passed as last argument to c:call/2
.
Note that c:init/1
may be called during initialization and as such it must
not return pids, ports or values that are specific to the runtime.
The API expected by a module plug is defined as a behaviour by the
FluentdForwarder.Handler
module (this module).
examples
Examples
defmodule InspectHandler do
@behaviour FluentdForwarder.Handler
def init(opts) do
opts
end
def call(tag, time, record, _opts) do
IO.inspect({tag, time, record})
end
end
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Link to this section Types
Link to this section Callbacks
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.