Skip to content

Log hooks/middlewares #15

@wuputah

Description

@wuputah

I would like to use Scrolls as a single logging pipe, but what I need to do is also have a way to capture that data via another (additional) mechanism than the STDOUT stream, for instance, a small class I wrote to store logs directly into Postgres. What would solve this nicely would be to register a hook with scrolls that is invoked when something is written to the logs:

Scrolls.hook(lambda { |data| MyClass.log(data) })

Better yet, we can use the Rack approach and have these hooks respond to #call, allowing something like:

Scrolls.hook MyClass
Scrolls.hook MyClass.new

I'd recommend that, for convenience, this method can also take a block that is automatically treated as a lambda function:

Scroll.hook { |data| MyClass.log(data) }

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions