Spaces:
Configuration error
Configuration error
File size: 621 Bytes
3f70c4e 8b40e41 3f70c4e 704aee6 76a3612 decc167 d22b35c decc167 d22b35c decc167 76a3612 3f70c4e 76a3612 3f70c4e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | package utils
import (
"log"
"os"
"api.qobiltu.id/config"
)
func LogError(errorLogged error) {
log.Println("Error Log :", errorLogged)
_, err := os.Stat(config.GlobalConfig.App.LogPath + "/error_log.txt")
if os.IsNotExist(err) {
_, err = os.Create(config.GlobalConfig.App.LogPath + "/error_log.txt")
if err != nil {
log.Fatalf("Gagal buka file log: %v", err)
}
}
file, err := os.OpenFile(config.GlobalConfig.App.LogPath+"/error_log.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)
if err != nil {
log.Fatalf("Gagal buka file log: %v", err)
}
log.SetOutput(file)
}
|