prism icon indicating copy to clipboard operation
prism copied to clipboard

Add more logs to support verbose logging levels

Open brendarearden opened this issue 1 year ago • 1 comments

With issue https://github.com/stoplightio/prism/issues/773 getting fixed, we should revisit logging to ensure we are logging what is necessary for all levels.


Info Level

Currently Includes:

  • "Starting..." / "Restarting..." / Loading..."
  • "Forwarding..."
  • "Received..."
  • "No operations found..." / "Unable to find..."

Should Include:

Current level of info logs is acceptable Potentially move some info logs to be debug logs


Debug Level

Currently Includes:

  • "Unable to find"

Should Include:

At least one debug log per main method to highlight main path through process (not every method)


Trace Level

Currently Includes:

None are currently implemented

Should Include:

At least one trace log per method, including inputs and method names, timestamps if possible If a calculation/transformation is done, resulting output


Warn Level

Currently Includes:

  • "Something went wrong"
  • "501 returned"
  • unknown format

Should Include:

Ensure all restarts include a warning Errors that don't cause the system to crash


Error Level

Currently Includes:

  • "Request terminated"

Should Include:

Need to log error anytime we stop the application after error


Fatal Level

Currently Includes:

  • when we cannot create prism server

Should Include:

Current level of fatal logs is acceptable

brendarearden avatar Mar 14 '23 18:03 brendarearden

A byproduct of allowing different log levels found during the initial review of the addition of verbose logging:

log level warn does not include info level logs - this makes server startup slightly confusing but also expected since the level is set to warn - not sure if we want to brain storm on not showing ANY startup logs.

This is the output when using warn - the server is up and available but we don't really have that info Screenshot 2023-03-13 at 1 34 33 PM

The starting message is using signale.await({ prefix: chalk.bgWhiteBright.black('[CLI]'), message: 'Starting Prism…' }); and not a logger since the server with logger isn't created at the time its emitted.

brendarearden avatar Mar 14 '23 18:03 brendarearden