go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/logutil/debug.go (about) 1 /* 2 3 Copyright (c) 2023 - Present. Will Charczuk. All rights reserved. 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository. 5 6 */ 7 8 package logutil 9 10 import ( 11 "fmt" 12 "log" 13 ) 14 15 // Debug prints a debug message with a given format and arguments. 16 func Debug(l *log.Logger, message string) { 17 if l == nil { 18 return 19 } 20 if l.Flags()&Ldebug == 0 { 21 return 22 } 23 l.Output(SDKStackDepth(), fmt.Sprintf("DEBUG: "+message)) 24 } 25 26 // Debugf prints a debug message with a given format and arguments. 27 func Debugf(l *log.Logger, format string, args ...interface{}) { 28 if l == nil { 29 return 30 } 31 if l.Flags()&Ldebug == 0 { 32 return 33 } 34 l.Output(2, fmt.Sprintf("DEBUG: "+format, args...)) 35 }