Skip to content

Make handle_message return true/false depending on if accepted #23

Description

@tkf

Continuing #1, it would be nice to have SwitchLogger as described below. Do you want to add a logger like this? If so, what is the name for it?


I'm +1 for TeeLogger, as I can imagine another logger wrapping multiple loggers that uses the fist matched logger. It can be used as, e.g., SwitchLogger(ProgressLogger(...), TBLogger(...), global_logger()), to let special loggers handle special log events. To be more precise, the implementation would be something like

function handle_message(logger::SwitchLogger, args...; kwargs...)
    i = findfirst(l -> comp_shouldlog(l, args...), logger.logging)
    i === nothing && return
    return handle_message(logger.logging[i], args...; kwargs...)
end

Originally posted by @tkf in #1 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions