mirror of
https://github.com/arnaucube/blockchainIDsystem.git
synced 2026-02-07 11:06:41 +01:00
peers propagation working fine, started to implement serverCA
This commit is contained in:
24
serverCA/log.go
Executable file
24
serverCA/log.go
Executable file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func savelog() {
|
||||
timeS := time.Now().String()
|
||||
_ = os.Mkdir("logs", os.ModePerm)
|
||||
//next 3 lines are to avoid windows filesystem errors
|
||||
timeS = strings.Replace(timeS, " ", "_", -1)
|
||||
timeS = strings.Replace(timeS, ".", "-", -1)
|
||||
timeS = strings.Replace(timeS, ":", "-", -1)
|
||||
logFile, err := os.OpenFile("logs/log-"+timeS+".log", os.O_CREATE|os.O_APPEND|os.O_RDWR, 0666)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
mw := io.MultiWriter(os.Stdout, logFile)
|
||||
log.SetOutput(mw)
|
||||
}
|
||||
Reference in New Issue
Block a user