You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
If I have two objects containing key (String) and value (String/Object) and I want to add them as static field to GelfEncoder I have to create new string in key:value format and pass it to method addStaticField(String staticField), where key and value are parsed from the staticField string.
Describe the solution you'd like
Method addStaticField(String key, String value) or addStaticField(String key, Object value) could be introduced in GelfEncoder, then key and value can be directly passed to method without creating/parsing of the string.
Describe alternatives you've considered
Create a string in key:value format and pass the string to method addStaticField(String staticField).
The text was updated successfully, but these errors were encountered:
I don't exactly understand your use case. If you're using the API (not the XML configuration) you could easily use a custom field mapper for this. See #78 for example. Doing so programmatically is even simpler:
Yes, I am using the API. In versions <=3.0.0 I was using the setStaticFields(Map<String, Object> staticFields) method in GelfEncoder initialization.
I did not want to use field mapper, because then all static fields keys are validated in the addField() method for each message, which seems redundant to me (keys will be the same). When addStaticField(String staticField) method is used, key validation is performed only during adding static field.
I just thought it could be useful for someone who was using setStaticFields() method in <=3.0.0 versions (reintroducing setStaticFields() could be another option).
If you think, it is not worth it, then issue can be closed. I am perfectly fine with the existing methods for setting static fields.
Is your feature request related to a problem? Please describe.
If I have two objects containing key
(String)
and value(String/Object)
and I want to add them as static field to GelfEncoder I have to create new string inkey:value
format and pass it to methodaddStaticField(String staticField)
, where key and value are parsed from thestaticField
string.Describe the solution you'd like
Method
addStaticField(String key, String value)
oraddStaticField(String key, Object value)
could be introduced in GelfEncoder, then key and value can be directly passed to method without creating/parsing of the string.Describe alternatives you've considered
Create a string in
key:value
format and pass the string to methodaddStaticField(String staticField)
.The text was updated successfully, but these errors were encountered: