Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Implement handler for outputting JSON from commands #394

Open
sanfrancrisko opened this issue Nov 10, 2021 · 0 comments
Open

Implement handler for outputting JSON from commands #394

sanfrancrisko opened this issue Nov 10, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@sanfrancrisko
Copy link

Currently, console output is handled by zerolog using the zerolog.ConsoleWriter formatter.

The pct new --list command supports the --format json flag, to output the templates in JSON format.

Across both PCT and PRM, each command should support --format json. We should have a handler that can be called to output in JSON format. Implementation will need to be determined after some analysis of zerolog's capabilities.

The preliminary ideas are to have a schema of:

{"error": "", "data": {}, "logs": []}

Error: The error message being logged from the call to log.Error()
Data: JSON from the command output to return (e.g. pct new --list --format json)
Logs: If possible, the logs that were being sent to zerolog

Considerations for logging:

  • If it not possible to output the JSON formatted logs to within the log parameter, then we should determine whether we write the logs to disk, instead
  • At INFO level, there should be no logs output
  • Zerolog should not output anything to console when --format json is specified

Acceptance Criteria

TBD when some more investigation is done

@chelnak chelnak transferred this issue from puppetlabs/devx Mar 29, 2022
@chelnak chelnak transferred this issue from another repository Apr 4, 2022
@chelnak chelnak added the enhancement New feature or request label May 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants