[SERVER-47924] Create a LOGV2 style linter Created: 04/May/20  Updated: 11/Jan/23  Resolved: 11/Jan/23

Status: Closed
Project: Core Server
Component/s: Build, Testing Infrastructure
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Spencer Jackson Assignee: Backlog - Security Team
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Security
Participants:

 Description   

There are a number of style decisions in log statements that we want to be able to programatically enforce. Some of these are relatively easy to enforce, some of them relatively difficult. We should create a linter which is capable of enforcing some of the easier properties, as a first pass.



 Comments   
Comment by Bruce Lucas (Inactive) [ 04/May/20 ]

Some simple checks:

  • No {} in message - these would be substitution strings which we only used as a transition aid
  • No _ in attr - camelCase is the norm, and also _ is most likely a result of the automated initial conversion
  • Attr names "ns", "nss", "collection" are likely wrong, should be "namespace"
  • "duration" attributes should have units of millis
  • Message should be capitalized. Slightly tricky because a natural exception occurs when the first word is an identifier (although arguably that should be discouraged as well?) A simple expedient might be that the first word of the message should have a capital letter in it somewhere.
  • Message shouldn't end with punctuation

The last two are minor.

Generated at Thu Feb 08 05:15:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.