mirror of
https://github.com/rwinkhart/go-boilerplate.git
synced 2026-08-27 20:36:29 -04:00
22 lines
383 B
Go
22 lines
383 B
Go
package web
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/rwinkhart/go-boilerplate/back"
|
|
)
|
|
|
|
// PrintLog colorizes a log and determines the best method for printing it.
|
|
func PrintLog(message, ansiColor string) {
|
|
if ansiColor != "" {
|
|
message = ansiColor + message + back.AnsiReset
|
|
}
|
|
if os.Getenv("INVOCATION_ID") != "" {
|
|
fmt.Println(message)
|
|
} else {
|
|
log.Println(message)
|
|
}
|
|
}
|