mirror of
https://github.com/pgsty/minio.git
synced 2026-07-20 12:40:24 +03:00
logging: Log only for unhandled errors, remove all the debug logging. (#1652)
This patch brings in the removal of debug logging altogether, instead we bring in the functionality of being able to trace the errors properly pointing back to the origination of the problem. To enable tracing you need to enable "MINIO_TRACE" set to "1" or "true" environment variable which would print back traces whenever there is an error which is unhandled or at the handler layer. By default this tracing is turned off and only user level logging is provided.
This commit is contained in:
committed by
Anand Babu (AB) Periasamy
parent
8828fd1e5c
commit
9472299308
+2
-25
@@ -16,11 +16,7 @@
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/fatih/color"
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/mc/pkg/console"
|
||||
)
|
||||
import "github.com/fatih/color"
|
||||
|
||||
// Global constants for Minio.
|
||||
const (
|
||||
@@ -41,7 +37,7 @@ const (
|
||||
|
||||
var (
|
||||
globalQuiet = false // Quiet flag set via command line
|
||||
globalDebug = false // Debug flag set via command line
|
||||
globalTrace = false // Trace flag set via environment setting.
|
||||
// Add new global flags here.
|
||||
)
|
||||
|
||||
@@ -51,22 +47,3 @@ var (
|
||||
colorWhite = color.New(color.FgWhite, color.Bold).SprintfFunc()
|
||||
colorGreen = color.New(color.FgGreen, color.Bold).SprintfFunc()
|
||||
)
|
||||
|
||||
// Set global states. NOTE: It is deliberately kept monolithic to
|
||||
// ensure we dont miss out any flags.
|
||||
func setGlobals(quiet, debug bool) {
|
||||
globalQuiet = quiet
|
||||
globalDebug = debug
|
||||
// Enable debug messages if requested.
|
||||
if globalDebug {
|
||||
console.DebugPrint = true
|
||||
}
|
||||
}
|
||||
|
||||
// Set global states. NOTE: It is deliberately kept monolithic to
|
||||
// ensure we dont miss out any flags.
|
||||
func setGlobalsFromContext(ctx *cli.Context) {
|
||||
quiet := ctx.Bool("quiet") || ctx.GlobalBool("quiet")
|
||||
debug := ctx.Bool("debug") || ctx.GlobalBool("debug")
|
||||
setGlobals(quiet, debug)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user