Skip to content

Commit

Permalink
internal/logging: Use millisecond time granularity for protocol data …
Browse files Browse the repository at this point in the history
…file naming (#245)

Reference: #244
  • Loading branch information
bflad authored Jan 5, 2023
1 parent 887b294 commit dcadf23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changelog/245.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:bug
tfprotov5/tf5server: Prevented `TF_LOG_SDK_PROTO_DATA_DIR` file overlap by switching from second to millisecond file naming granularity
```

```release-note:bug
tfprotov6/tf6server: Prevented `TF_LOG_SDK_PROTO_DATA_DIR` file overlap by switching from second to millisecond file naming granularity
```
2 changes: 1 addition & 1 deletion internal/logging/protocol_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func protocolDataDynamicValue6(_ context.Context, value *tfprotov6.DynamicValue)
}

func writeProtocolFile(ctx context.Context, dataDir string, rpc string, message string, field string, fileExtension string, fileContents []byte) {
fileName := fmt.Sprintf("%d_%s_%s_%s", time.Now().Unix(), rpc, message, field)
fileName := fmt.Sprintf("%d_%s_%s_%s", time.Now().UnixMilli(), rpc, message, field)

if fileExtension != "" {
fileName += "." + fileExtension
Expand Down

0 comments on commit dcadf23

Please sign in to comment.