orhanobut / logger

✔️ Simple, pretty and powerful logger for android
Apache License 2.0
13.82k stars 2.14k forks source link

Separate log properties from format strategy implementation #183

Open jbarbadillo opened 6 years ago

jbarbadillo commented 6 years ago

Feature request for separating log properties from the implementation of the specific format strategy.

It would make the library more flexible and powerful, more configurable. For example CsvFormatStrategy has the following properties:

It would be nice to be able to add custom properties like app, device, etc.

orhanobut commented 6 years ago

Interesting idea. Would you mind to give me some example from integration point of view? For example, when you initialize Logger how it would look like and when you log anything, how it would look like as output?

jbarbadillo commented 6 years ago

Ok. The idea is that the logger has some default and necessary fields like timestamp, level, message, tag, all of them independent of the format strategy. But then a properties object may contain other fields that are desirable for a custom project: deviceId, method, eventDescrition, secondaryTag. These properties should be configured once and the beggining using a configure method for passing the adapters, strategies and properties.

I am not an expert in Java so it will take me some time to think how I would initialize the logger, but the idea is to do something like this library structlog in Python.

orhanobut commented 6 years ago

Let me check that python library to understand more. I see that logging into disk feature might be more powerful and useful.