-
Notifications
You must be signed in to change notification settings - Fork 491
Open
Description
When using a hclog logger with json format in the plugin side and using json as format, the logs that will be output by the host will show the json keys in a non deterministic order.
For example, changing the Greet method from the basic example to:
func (g *GreeterHello) Greet() string {
g.logger.Debug("message from GreeterHello.Greet")
for i := 0; i < 50; i++ {
g.logger.Debug("##msg from plugin##", "param1", 1, "param2", 2)
}
return "Hello!"
}and running ./basic will show lines like:
2023-07-31T11:53:11.727+0200 [DEBUG] plugin.greeter: ##msg from plugin##: param1=1 param2=2 timestamp=2023-07-31T11:53:11.727+0200
2023-07-31T11:53:11.727+0200 [DEBUG] plugin.greeter: ##msg from plugin##: param2=2 param1=1 timestamp=2023-07-31T11:53:11.727+0200
2023-07-31T11:53:11.727+0200 [DEBUG] plugin.greeter: ##msg from plugin##: param1=1 param2=2 timestamp=2023-07-31T11:53:11.727+0200
2023-07-31T11:53:11.727+0200 [DEBUG] plugin.greeter: ##msg from plugin##: param2=2 param1=1 timestamp=2023-07-31T11:53:11.727+0200where the order of the log keys is not preserved
Metadata
Metadata
Assignees
Labels
No labels