|
|
|
@ -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
|
|
|
|
|