From ecf2c2279fd03928e6b86ef3b5b02cd4df2c1867 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Wed, 28 Apr 2021 17:49:06 -0600 Subject: [PATCH] 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'). --- log/formatting_linux.go | 38 ------------------- ...ormatting_darwin.go => formatting_unix.go} | 2 + log/formatting_windows.go | 2 + 3 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 log/formatting_linux.go rename log/{formatting_darwin.go => formatting_unix.go} (96%) diff --git a/log/formatting_linux.go b/log/formatting_linux.go deleted file mode 100644 index f24cf32..0000000 --- a/log/formatting_linux.go +++ /dev/null @@ -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" -} diff --git a/log/formatting_darwin.go b/log/formatting_unix.go similarity index 96% rename from log/formatting_darwin.go rename to log/formatting_unix.go index f24cf32..1e56839 100644 --- a/log/formatting_darwin.go +++ b/log/formatting_unix.go @@ -1,3 +1,5 @@ +// +build !windows + package log const ( diff --git a/log/formatting_windows.go b/log/formatting_windows.go index 2ec7a15..c9fd2fb 100644 --- a/log/formatting_windows.go +++ b/log/formatting_windows.go @@ -1,3 +1,5 @@ +// +build windows + package log import (