mirror of
https://github.com/safing/portbase
synced 2025-09-04 11:40:23 +00:00
Unify the log/formatting_*.go files for all unix like OSs
This switches to using the +build tag in log/formatting so that a single file can be used to build for *NIX machines (everything that isn't 'windows').
This commit is contained in:
parent
dc6ca2b949
commit
ecf2c2279f
3 changed files with 4 additions and 38 deletions
|
@ -1,38 +0,0 @@
|
||||||
package log
|
|
||||||
|
|
||||||
const (
|
|
||||||
rightArrow = "▶"
|
|
||||||
leftArrow = "◀"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// colorBlack = "\033[30m"
|
|
||||||
colorRed = "\033[31m"
|
|
||||||
// colorGreen = "\033[32m"
|
|
||||||
colorYellow = "\033[33m"
|
|
||||||
colorBlue = "\033[34m"
|
|
||||||
colorMagenta = "\033[35m"
|
|
||||||
colorCyan = "\033[36m"
|
|
||||||
// colorWhite = "\033[37m"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (s Severity) color() string {
|
|
||||||
switch s {
|
|
||||||
case DebugLevel:
|
|
||||||
return colorCyan
|
|
||||||
case InfoLevel:
|
|
||||||
return colorBlue
|
|
||||||
case WarningLevel:
|
|
||||||
return colorYellow
|
|
||||||
case ErrorLevel:
|
|
||||||
return colorRed
|
|
||||||
case CriticalLevel:
|
|
||||||
return colorMagenta
|
|
||||||
default:
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func endColor() string {
|
|
||||||
return "\033[0m"
|
|
||||||
}
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// +build !windows
|
||||||
|
|
||||||
package log
|
package log
|
||||||
|
|
||||||
const (
|
const (
|
|
@ -1,3 +1,5 @@
|
||||||
|
// +build windows
|
||||||
|
|
||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
Loading…
Add table
Reference in a new issue