Automatic registration of log contexts

9 views
Skip to first unread message

Nickolas Pohilets

unread,
Feb 8, 2017, 10:49:52 AM2/8/17
to CocoaLumberjack
I want to improve IGWebLogger to be able to to filter by context. Since contexts are just cryptic numbers, I need to have some kind of dictionary that maps log context values to human-readable descriptions.

I'm planning to make:
-  Abstract mapping into protocol:
- I need method to return all possible contexts, in some order
- Method that would map context id to context name
- Provide default implementation that performs discovery based on ObjC runtime, and sorts by name.
- For discovery I can either add new methods to DDRegisteredDynamicLogging or use distinct protocol (e.g. DDRegisteredContextDiscovery)

Which of the above entities does it makes sense to add to CocoaLumberjack vs IGWebLogger?

Another alternative would be to use string tags instead of numeric contexts. This would make them self-descriptive. But each tag would become known only when first event of this kind is emitted. This makes UI for filtering quite inconvenient to use - I would prefer to set all the filtering first, and then focus on debugging.

BTW, what is the intended usage of that tag field?

Reply all
Reply to author
Forward
0 new messages