@iilyak  said:
>> So "action: compaction_start" might be a useful one that these examples miss 
>> out.
>
> We definitely missed action field. How would you add it to API? Are you 
> proposing to add into ExtraFields?

Yes, I'd have it in extra fields. Not all log messages need it. Make it 
convention rather than enforced.

@eiri said:

> I think an action field is a good idea with one caveat that without formal 
> naming strategy it's fairly simple to get a lot of inconsistencies in there 
> and have for example starting_compaction in one place and compaction_start in 
> another. 

I can totally see this. I'd prefer to start with seeing if it's a problem in 
practice. Hopefully we are not starting the same process in many places 😄 

> I personally don't think that's the case, with a message log("Starting 
> compaction for shard ~p on update sequence ~p", [<<"shard">>, 12]) it would 
> be helpful to have an ability to query by shard field, much less so for 
> update_sequence field.

That's a really good point. Looking at other things I've used in the past, they 
do split up the idea of the format args for the message from the extra 
structured fields args. 

I think @iilyak's proposal takes that into account:

```
couch_log:error("Compaction started for ~p", [shard], #{
     user => "foo", 
     shard => "shards/..."
}).
```

I, at least, found this a very readable code stanza.

[ Full content available at: https://github.com/apache/couchdb/issues/1373 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to