MCPcopy Index your code
hub / github.com/devspace-sh/devspace / OverrideRuntimeErrorHandler

Function OverrideRuntimeErrorHandler

pkg/util/log/file_logger.go:69–94  ·  view source on GitHub ↗

OverrideRuntimeErrorHandler overrides the standard runtime error handler that logs to stdout with a file logger that logs all runtime.HandleErrors to errors.log

(discard bool)

Source from the content-addressed store, hash-verified

67// OverrideRuntimeErrorHandler overrides the standard runtime error handler that logs to stdout
68// with a file logger that logs all runtime.HandleErrors to errors.log
69func OverrideRuntimeErrorHandler(discard bool) {
70 overrideOnce.Do(func() {
71 if discard {
72 if len(runtime.ErrorHandlers) > 0 {
73 runtime.ErrorHandlers[0] = func(err error) {}
74 } else {
75 runtime.ErrorHandlers = []func(err error){
76 func(err error) {},
77 }
78 }
79 } else {
80 errorLog := GetFileLogger("errors")
81 if len(runtime.ErrorHandlers) > 0 {
82 runtime.ErrorHandlers[0] = func(err error) {
83 errorLog.Errorf("Runtime error occurred: %s", err)
84 }
85 } else {
86 runtime.ErrorHandlers = []func(err error){
87 func(err error) {
88 errorLog.Errorf("Runtime error occurred: %s", err)
89 },
90 }
91 }
92 }
93 })
94}
95
96func (f *fileLogger) addPrefixes(message string) string {
97 prefix := ""

Callers 2

RunUIMethod · 0.92
StartFileLoggingFunction · 0.85

Calls 2

GetFileLoggerFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected