2017-09-03 19:19:28 -04:00
|
|
|
package common
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// LogFail is the failure log formatter
|
|
|
|
|
// prints text to stderr and exits with status 1
|
|
|
|
|
func LogFail(text string) {
|
|
|
|
|
fmt.Fprintln(os.Stderr, fmt.Sprintf("FAILED: %s", text))
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// LogInfo1 is the info1 header formatter
|
|
|
|
|
func LogInfo1(text string) {
|
|
|
|
|
fmt.Fprintln(os.Stdout, fmt.Sprintf("-----> %s", text))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// LogInfo1Quiet is the info1 header formatter (with quiet option)
|
|
|
|
|
func LogInfo1Quiet(text string) {
|
2019-01-21 17:09:28 -05:00
|
|
|
if os.Getenv("DOKKU_QUIET_OUTPUT") == "" {
|
2017-09-03 19:19:28 -04:00
|
|
|
LogInfo1(text)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// LogInfo2 is the info2 header formatter
|
|
|
|
|
func LogInfo2(text string) {
|
|
|
|
|
fmt.Fprintln(os.Stdout, fmt.Sprintf("=====> %s", text))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// LogInfo2Quiet is the info2 header formatter (with quiet option)
|
|
|
|
|
func LogInfo2Quiet(text string) {
|
2017-10-04 00:48:02 -04:00
|
|
|
if os.Getenv("DOKKU_QUIET_OUTPUT") == "" {
|
2017-09-03 19:19:28 -04:00
|
|
|
LogInfo2(text)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-03 20:36:09 -04:00
|
|
|
// LogVerbose is the verbose log formatter
|
|
|
|
|
// prints indented text to stdout
|
2017-09-03 20:05:15 -04:00
|
|
|
func LogVerbose(text string) {
|
|
|
|
|
fmt.Fprintln(os.Stdout, fmt.Sprintf(" %s", text))
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-03 20:36:09 -04:00
|
|
|
// LogVerboseQuiet is the verbose log formatter
|
|
|
|
|
// prints indented text to stdout (with quiet option)
|
2017-09-03 20:05:15 -04:00
|
|
|
func LogVerboseQuiet(text string) {
|
2019-01-21 17:09:28 -05:00
|
|
|
if os.Getenv("DOKKU_QUIET_OUTPUT") == "" {
|
2017-09-03 20:05:15 -04:00
|
|
|
LogVerbose(text)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-03 19:19:28 -04:00
|
|
|
// LogWarn is the warning log formatter
|
|
|
|
|
func LogWarn(text string) {
|
|
|
|
|
fmt.Fprintln(os.Stderr, fmt.Sprintf(" ! %s", text))
|
|
|
|
|
}
|