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

Lib/log: linting and small improvements #1959

Merged
merged 3 commits into from
Jan 18, 2022
Merged

Conversation

gaelicWizard
Copy link
Contributor

@gaelicWizard gaelicWizard commented Sep 20, 2021

Please review commit notes as appropriate.

Description

This is a partial PR covering only the lib/log portion of #1917 in support of #1696.

Motivation and Context

My shellcheck branch (#1917) got a bit large, so I'm splitting it up. This PR is independent of my other PRs.

The only non-trivial change here is renaming _log_general() to _bash-it-log-message() and new function to replace _set-prefix-based-on-path().

How Has This Been Tested?

The full test suite and shellcheck have run on #1917 and this is part of my main branch.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the code style of this project.
  • If my change requires a change to the documentation, I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • If I have added a new file, I also added it to clean_files.txt and formatted it using lint_clean_files.sh.
  • I have added tests to cover my changes, and all the new and existing tests pass.

@gaelicWizard gaelicWizard changed the title DRAFT: prepare lib/log for shellcheck prepare lib/log for shellcheck, and some fixup Dec 29, 2021
@gaelicWizard gaelicWizard marked this pull request as ready for review December 29, 2021 06:06
@gaelicWizard gaelicWizard changed the title prepare lib/log for shellcheck, and some fixup Lint lib/log Dec 29, 2021
@gaelicWizard gaelicWizard mentioned this pull request Dec 29, 2021
6 tasks
@gaelicWizard gaelicWizard changed the title Lint lib/log Lib/log: linting and small improvements Jan 2, 2022
lib/log.bash Show resolved Hide resolved
test/run Outdated Show resolved Hide resolved
Alsö, fix tests to load `lib/colors` instead of `lib/appearance`...wut

Alsö, `short-circuit _has_colors()`: If we already looked up colors, and we already have them, then don't run `tput` again.

My apologies to future `git blame` hunters ♥
...to `_bash-it-log-message()`.

alsö, add common log levels with common names.
...to replace `_set-prefix-based-on-path()` in `scripts/reloader`.

Deliberately does not use `_bash-it-get-component-name-from-path()`/`_bash-it-get-component-type-from-path()` as we need some of the intermediate state and would have to reimplement anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants