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

logging functionality #10

Open
client9 opened this issue Mar 8, 2018 · 0 comments
Open

logging functionality #10

client9 opened this issue Mar 8, 2018 · 0 comments

Comments

@client9
Copy link
Owner

client9 commented Mar 8, 2018

Much of the code uses echo as way of returning results or a partial result in a pipe.

Other times echo is used as a logging mechanism, and inconsistently.

Here are two examples of the later:

uname_os_check.sh:  echo "$0: uname_os_check: internal error '$(uname -s)' got converted to '$os' which is not a GOOS value. Please file bug at https://github.com/client9/shlib"
untar.sh:      echo "Unknown archive format for ${tarball}"

Both also go to stdout, not stderr.

Better would be to have a function that does logging.

Thinking

log_error
log_info
log_debug
log_prefix 

The last one would be a function that would emit a common prefix. A function so smart people could completely over-ride it and add a date or whatever, but by default it would be:

log_prefix() {
  echo $0  or nothing ""
}

Also need some way of setting the level. Will need to see what syslog and friends do.

n

client9 pushed a commit that referenced this issue Mar 8, 2018
client9 pushed a commit that referenced this issue Mar 8, 2018
client9 pushed a commit that referenced this issue Mar 9, 2018
client9 pushed a commit that referenced this issue Mar 9, 2018
client9 pushed a commit that referenced this issue Mar 9, 2018
client9 pushed a commit that referenced this issue Mar 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants