mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-10 16:16:47 +00:00

* [NOD-310] Implement REST server in API server * [NOD-310] MetaData -> Metadata * [NOD-310] Make custom context methods instead of custom request functions * [NOD-310] change "Request ID" prefix to "RID" and convert to apiServerContext with newAPIServerContext everywhere
25 lines
710 B
Go
25 lines
710 B
Go
package logger
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/daglabs/btcd/logs"
|
|
"os"
|
|
)
|
|
|
|
// BackendLog is the logging backend used to create all subsystem loggers.
|
|
var BackendLog = logs.NewBackend()
|
|
|
|
// InitLog attaches log file and error log file to the backend log.
|
|
func InitLog(logFile, errLogFile string) {
|
|
err := BackendLog.AddLogFile(logFile, logs.LevelTrace)
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Error adding log file %s as log rotator for level %s: %s", logFile, logs.LevelTrace, err)
|
|
os.Exit(1)
|
|
}
|
|
err = BackendLog.AddLogFile(errLogFile, logs.LevelWarn)
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Error adding log file %s as log rotator for level %s: %s", errLogFile, logs.LevelWarn, err)
|
|
os.Exit(1)
|
|
}
|
|
}
|