mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-11 13:53:16 +00:00
Allow logging function to be customized
This commit is contained in:
@@ -23,6 +23,7 @@ const (
|
||||
ASSERT = 4
|
||||
)
|
||||
|
||||
var LogFunction func(level int, logID string, message string)
|
||||
|
||||
var printLogHeader = false
|
||||
|
||||
@@ -117,6 +118,11 @@ func logf(level int, logID string, format string, v ...interface{}) {
|
||||
|
||||
message := fmt.Sprintf(format, v...)
|
||||
|
||||
if LogFunction != nil {
|
||||
LogFunction(level, logID, message)
|
||||
return
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
|
||||
// Uncomment this line to enable unbufferred logging for tests
|
||||
|
||||
Reference in New Issue
Block a user