Merge branch 'newgen' of b612/starlog into master

master
兔子 4 years ago committed by Gogs
commit 0a8bfdcfe1

@ -33,7 +33,7 @@ type logfileinfo struct {
func SetLogFile(path string, logger *StarLogger, appendMode bool) error { func SetLogFile(path string, logger *StarLogger, appendMode bool) error {
var fileMode int var fileMode int
if appendMode { if appendMode {
fileMode = os.O_APPEND | os.O_CREATE fileMode = os.O_APPEND | os.O_CREATE | os.O_WRONLY
} else { } else {
fileMode = os.O_CREATE | os.O_WRONLY fileMode = os.O_CREATE | os.O_WRONLY
} }
@ -83,7 +83,7 @@ func SetLogFile(path string, logger *StarLogger, appendMode bool) error {
func CloseWithSwitching(logger *StarLogger) error { func CloseWithSwitching(logger *StarLogger) error {
if archMap.MustGet(logger.logcore.id) != nil { if archMap.MustGet(logger.logcore.id) != nil {
logger.SetSwitching(true) logger.SetSwitching(true)
err := archMap.MustGet(logger.logcore.id).(*os.File).Close() err := archMap.MustGet(logger.logcore.id).(logfileinfo).pointer.Close()
if err != nil { if err != nil {
logger.logcore.output = nil logger.logcore.output = nil
return err return err

Loading…
Cancel
Save