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