opsgenie / opsgenie-lamp

OpsGenie Lamp with Go SDK
Apache License 2.0
34 stars 18 forks source link

Output is not machine-readble and written to stderr #47

Open loganlinn opened 3 years ago

loganlinn commented 3 years ago

I installed this tool for the first time and wanted to share some usability issues I had.

  1. Command output is written to stderr. Expected: output is written to stdout. The 12 Factor CLI Apps blog post provides guidance on utilizing std input/output streams in a predictable manner.
  2. Command output is a log message. Expected: commands that produce JSON/YAML data should be written directly to output stream rather than through a log formatter.

Addressing this behavior would significantly improve the utility of this tool, especially for scripting and automation.

dmitry-mightydevops commented 2 years ago
➜ opsgenie listAlerts --pretty
2022/04/01 20:10:37 INFO: Logging to file is disabled, To enable Logging to file Please specify logPath in configuration
INFO[2022-04-01T20:10:37.946970039-05:00] Client is configured with ApiUrl: api.opsgenie.com, LogLevel: info, RetryMaxCount: 4 
2022/04/01 20:10:38 INFO : [
    {
        "seen": true,
        "id": "31577003-f296-4e07-9069-747b5860282b-1648854679986",
        "tinyId": "6",
        "alias": "09ceb662-b2e8-4f43-9741-15413211db3e_6f52fa37-1fff-4019-a5c9-1e755ed70a84",
        "message": "test incident 1",

I can't believe it's displayed as a log entry :) how am I supposed to apply jq or yq?

setting up config file with something like this: logLevel=error has no effect.

dustinschultz commented 1 year ago

In the config file, put

lamp.log.level=error

and that will suppress the default INFO log statement so you can pipe it to jq