Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log #486

Merged
merged 13 commits into from
Jul 30, 2020
Merged

Log #486

merged 13 commits into from
Jul 30, 2020

Conversation

nemchik
Copy link
Collaborator

@nemchik nemchik commented Jul 27, 2020

Fixes #485

Proposed Changes

  1. Add log functions so that we have different levels of logging, automatic formatting (colors), timestamps, and logging happens to the console (based on user defined verbosity) and a log file (regardless of verbosity - although we can consider user defined verbosity here as well)
  2. Any output that the user should see (almost all echo calls) should use the log functions
  3. Allow the user to define verbosity for the console output (default to full verbosity and allow users to lower it with a variable)

Log Functions Added

  • fatal will display a fatal message (red background, white text) AND will exit 1. Always displayed regardless of LOG_LEVEL
  • error will display an error message (red text). Always displayed regardless of LOG_LEVEL
  • warn will display a warn message (yellow text). Always displayed regardless of LOG_LEVEL
  • notice will display a notice message (green text). Always displayed regardless of LOG_LEVEL
  • info will display an info message (blue text). Only displays if 'LOG_LEVELis set toVERBOSE`
  • debug will display a debug message (blue text). Only displays if 'LOG_LEVELis set toDEBUG`
  • trace will display a trace message (blue text). Only displays if 'LOG_LEVELis set toTRACE`

All messages (regardless of LOG_LEVEL are output to the LOG_FILE

Readiness Checklist

  • Label as breaking if this is a large fundamental change
  • Label as either automation, bug, documentation, enhancement, infrastructure, or performance

Remaining Tasks

  • Replace all lines that currently produce loggable output with log functions (so the log file is used)
  • Add the code to allow setting the verbosity level
    • Default to full verbosity (output everything)
    • Replace existing notice calls with info calls as needed
  • Document the new user facing variables

@admiralAwkbar admiralAwkbar self-assigned this Jul 29, 2020
@admiralAwkbar admiralAwkbar added bug Something isn't working enhancement New feature or request labels Jul 29, 2020
@admiralAwkbar
Copy link
Collaborator

Looks good

@nemchik nemchik marked this pull request as ready for review July 30, 2020 19:30
@zkoppert
Copy link
Contributor

hey just checking in, Can you check off the boxes that you completed in the description.

@nemchik
Copy link
Collaborator Author

nemchik commented Jul 30, 2020

hey just checking in, Can you check off the boxes that you completed in the description.

Done, and added one last task unless anyone looks through this sooner and finds something else that should be adjusted.

I figure we may over time move around what is output as fatal, error, warn, notice, info, debug, and trace. Speaking of, I'll document in the OP a little about each of them.

lib/worker.sh Outdated Show resolved Hide resolved
@nemchik nemchik requested a review from zkoppert July 30, 2020 20:26
@nemchik
Copy link
Collaborator Author

nemchik commented Jul 30, 2020

Ok, documentation is added. This should be ready to merge.

Copy link
Contributor

@zkoppert zkoppert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@nemchik nemchik merged commit d0c3b77 into master Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OUTPUT_LOG option
3 participants