S&W Go Utilities
Go to file
starkandwayne-bot 896b8a6904 Updating CODE_OF_CONDUCT.md 2019-01-15 15:25:30 -05:00
ansi Revert "Swapped blue and green" 2017-03-03 15:46:35 -05:00
botta Updated godeps 2016-08-23 15:26:38 -04:00
log Support Trace-level log messages 2017-07-19 13:38:05 -04:00
timestamp adding timestamp to utils 2016-11-01 09:26:12 -04:00
tree Added tree.PathSegments to return an array of array of path segments for each full path 2017-05-29 18:35:39 -07:00
CODE_OF_CONDUCT.md Updating CODE_OF_CONDUCT.md 2019-01-15 15:25:30 -05:00
README.md Update README 2017-11-18 23:37:12 -05:00

README.md

goutils

S&W Go Utilities

NOTICE: THIS REPOSITORY IS BEING RETIRED

You may want to refer to these other repos, which will be supported moving forward:

Additionally, timestamp and botta are both being deprecated for lack of use.

How To Use

Get:

go get github.com/starkandwayne/goutils/{{pkg}}

Import:

import "github.com/starkandwayne/goutils/{{pkg}}"

Log

Setup logging with SetupLogging():

  • Type: logging mode to use - file, syslog, console
  • Level: debug, info, error, etc. (See all levels below.)
  • Facility: syslog facility to log to - daemon, misc, etc.
  • File: path to log to file if in file mode.

e.g.:

log.SetupLogging(LogConfig{ Type: "console", Level: "warning" })

If logging is not setup, then the messages will simply go to stdout. If logging cannot be setup for file or syslog, then the default stdout will be used. An error message will print to stderr to notify you if this occurs.

Log has the following levels defined:

  • Debug
  • Info
  • Notice
  • Warn
  • Error
  • Crit
  • Alert
  • Emerg

Usage is the same as Sprintf/Printf statements - simply append an f to the desired level. e.g.:

dbug_mesg := "This isn't a bug."
log.Debugf("I really need to know this in debug mode: %s", dbug_mesg)