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

Fixed some tests that would not pass, fixed some shellcheck warnings, used shellformat to format script #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

speedythesnail
Copy link

@speedythesnail speedythesnail commented Jan 7, 2024

  • Updated some failing tests (namely the json file tests, which were incorrectly looking for the non-json log file)
  • Parameterized the script name instead of running $(basename 0) everywhere
  • Parameterized the logfile paths for the regular .log and the json ones (maybe would be useful in the future, probably not)
  • Add a test to determine if /var/log/message and /var/log/debug exists, if not, default to using /var/log/syslog (many Linux distros do not have the aforementioned paths anymore, unless you change your syslog config, namely Ubuntu and Linux Mint)
  • changed logging function from using printf to just using bash variable substitution (log.sh line 88), presumably there could a be a very slight performance gain by not calling printf
  • Change process id from '${$}' to '$$'
  • Fixed some issues that shellcheck reports when linting script
  • Ran shellformat to cleanup code formatting

I appreciate this logging framework, thank you much!

I apologize for the massive diff due to running shellformat. It's a great plugin that I use to keep all my scripts clean and tidy.

Fix tests, update potential logs paths (if no messages file, then use syslog)
Change lowercase from using a subprocess, to using native bash variable manipulation.

shellformat
Fix script_name variable that may modify it for scripts sourcing this library. Hopefully name is unlikely to be used by someone else.
Fix grep for script log, should be ^*log.sh and not ^log.sh
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.

1 participant