MCPcopy Create free account
hub / github.com/XmirrorSecurity/OpenSCA-cli / CreateLog

Function CreateLog

opensca/logs/log.go:59–77  ·  view source on GitHub ↗
(logPath string)

Source from the content-addressed store, hash-verified

57var LogFilePath string
58
59func CreateLog(logPath string) {
60
61 if logPath == "" {
62 Debug("create default log")
63 createDefaultLog()
64 return
65 }
66
67 os.MkdirAll(filepath.Dir(logPath), 0777)
68 if f, err := os.Create(logPath); err != nil {
69 Warnf("create log %s err: %s, create default log", logPath, err)
70 createDefaultLog()
71 } else {
72 Debugf("log file: %s", logPath)
73 LogFilePath = logPath
74 log.SetOutput(f)
75 }
76
77}
78
79func createDefaultLog() {
80

Callers 1

argsFunction · 0.92

Calls 4

DebugFunction · 0.85
createDefaultLogFunction · 0.85
WarnfFunction · 0.85
DebugfFunction · 0.85

Tested by

no test coverage detected