]> Cypherpunks.ru repositories - goredo.git/blobdiff - log.go
Various refactoring
[goredo.git] / log.go
diff --git a/log.go b/log.go
index 335ca53c3d0a146079286a4c4b04caed91c6f450..f4fa2ca9c65f647b8aa1d48d71232984b76bed90 100644 (file)
--- a/log.go
+++ b/log.go
@@ -20,12 +20,21 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 package main
 
 import (
+       "flag"
        "fmt"
        "os"
        "strings"
 )
 
 const (
+       EnvLevel   = "REDO_LEVEL"
+       EnvDebug   = "REDO_DEBUG"
+       EnvLogWait = "REDO_LOG_WAIT"
+       EnvLogLock = "REDO_LOG_LOCK"
+       EnvLogPid  = "REDO_LOG_PID"
+       EnvLogJS   = "REDO_LOG_JS"
+       EnvNoColor = "NO_COLOR"
+
        CReset   = "\033[0m"
        CBold    = "\033[1m"
        CBlack   = "\033[30;1m"
@@ -48,12 +57,19 @@ const (
 )
 
 var (
+       Level   = 0
        NoColor bool
        Debug   bool
        LogWait bool
        LogLock bool
        LogJS   bool
        MyPid   int
+
+       flagDebug   = flag.Bool("debug", false, "enable debug logging (REDO_DEBUG=1)")
+       flagLogWait = flag.Bool("log-wait", false, "enable wait messages logging (REDO_LOG_WAIT=1)")
+       flagLogLock = flag.Bool("log-lock", false, "enable lock messages logging (REDO_LOG_LOCK=1)")
+       flagLogPid  = flag.Bool("log-pid", false, "append PIDs (REDO_LOG_PID=1)")
+       flagLogJS   = flag.Bool("log-js", false, "enable jobserver messages logging (REDO_LOG_JS=1)")
 )
 
 func trace(level, format string, args ...interface{}) {