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
It would be nice to either pass the Json flag to the hclogger instance or if something like an hclog->slog adapter was use d (like https://github.com/evanphx/go-hclog-slog, but in the opposite direction. Not sure if such a package exists / is possible)
Log output "as is"
{"time":"2024-03-19T14:29:53.249651675Z","level":"INFO","msg":"Using '/srv/tusd-data/data' as directory storage."}
{"time":"2024-03-19T14:29:53.250772425Z","level":"INFO","msg":"Using 0.00MB as maximum size."}
{"time":"2024-03-19T14:29:53.250811027Z","level":"INFO","msg":"Using '/usr/local/bin/tusd-hook-plugin' to load plugin for hooks"}
2024/03/19 02:29:53.251028 [DEBUG] plugin: starting plugin: path=/usr/local/bin/tusd-hook-plugin args=["/usr/local/bin/tusd-hook-plugin"]
2024/03/19 02:29:53.251524 [DEBUG] plugin: plugin started: path=/usr/local/bin/tusd-hook-plugin pid=15
2024/03/19 02:29:53.251638 [DEBUG] plugin: waiting for RPC address: plugin=/usr/local/bin/tusd-hook-plugin
2024/03/19 02:29:53.259521 [DEBUG] plugin.tusd-hook-plugin: plugin address: network=unix address=/tmp/plugin1135885035 timestamp=2024-03-19T14:29:53.259Z
2024/03/19 02:29:53.262943 [INFO] plugin.tusd-hook-plugin: Setup: timestamp=2024-03-19T14:29:53.26
...
Thank you for reporting this. The easiest solution would be to set hclog.LoggerOptions.JSONFormat = true if the JSON format is specified in the flags. This could be passed in using a new field in the PluginHook struct. Would you be willing to open a PR for this?
Describe the bug
Using
-log-format=json
does not apply to logging of (hc)pluginTo Reproduce
Steps to reproduce the behavior:
-log-format=json
and (hc)plugin hookExpected behavior
All logs are formatted as json
Setup details
I tried using both "log" and hc-log in the plugin.
Initializing the logger in the plugin using
does not produce the desired results.
Instead I had to add
JSONFormat: true,
totusd/pkg/hooks/plugin/plugin.go
Lines 36 to 40 in 50b9ff5
It would be nice to either pass the Json flag to the hclogger instance or if something like an hclog->slog adapter was use d (like https://github.com/evanphx/go-hclog-slog, but in the opposite direction. Not sure if such a package exists / is possible)
Log output "as is"
Log output using: https://github.com/quality-leftovers/tusd/tree/plugin-log-json
The text was updated successfully, but these errors were encountered: