Skip to content

Enhancement: Logger that can be flushed? to better cooperate with CocoaLumberjack #171

@mman

Description

@mman

I use Log and Logger API for general logging needs in my custom packages on Linux and iOS. Everything works great.

On iOS I initialize the Log.logger (for historical reasons and cooperation with legacy code) with my custom implementation of https://github.com/CocoaLumberjack/CocoaLumberjack based Logger implementation.

Also works great. Except for one thing. CocoaLumberjack is high perf and highly async, and when my app crashes controllably, the last few most important log statements are lost.

For that CocoaLumberjack provides a method DDLog.flushLog https://github.com/CocoaLumberjack/CocoaLumberjack/blob/832adf8139ee8b9810683a110a2318a9ea225a5a/Sources/CocoaLumberjack/include/CocoaLumberjack/DDLog.h#L367.

I would like to open a PR to propose addition of Logger.flush() and Log.flush() methods that would allow my app to invoke these methods and propagate them down in order to make sure logging is flushed in cases where app is terminated in a controlled manner.

What do you think? How you achieve the same?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementImprovements to existing feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions