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 {
var fileMode int
if appendMode {
fileMode = os.O_APPEND | os.O_CREATE
fileMode = os.O_APPEND | os.O_CREATE | os.O_WRONLY
} else {
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 {
if archMap.MustGet(logger.logcore.id) != nil {
logger.SetSwitching(true)
err := archMap.MustGet(logger.logcore.id).(*os.File).Close()
err := archMap.MustGet(logger.logcore.id).(logfileinfo).pointer.Close()
if err != nil {
logger.logcore.output = nil
return err

Loading…
Cancel
Save