Skip to content

Commit

Permalink
rename files to mulitfile
Browse files Browse the repository at this point in the history
  • Loading branch information
JessonChan committed Mar 8, 2016
1 parent 54b5120 commit b2f0713
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions logs/mulitfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
// means if the file name in configuration is project.log filesLogWriter will create project.error.log/project.debug.log
// and write the error-level logs to project.error.log and write the debug-level logs to project.debug.log
// the rotate attribute also acts like fileLogWriter
type filesLogWriter struct {
type mulitFileLogWriter struct {
writers [LevelDebug + 1 + 1]*fileLogWriter // the last one for fullLogWriter
fullLogWriter *fileLogWriter
Separate []string `json:"separate"`
Expand All @@ -45,7 +45,7 @@ var levelNames = [...]string{"emergency", "alert", "critical", "error", "warning
// "separate":["emergency", "alert", "critical", "error", "warning", "notice", "info", "debug"],
// }

func (f *filesLogWriter) Init(config string) error {
func (f *mulitFileLogWriter) Init(config string) error {
writer := newFileWriter().(*fileLogWriter)
err := writer.Init(config)
if err != nil {
Expand Down Expand Up @@ -76,15 +76,15 @@ func (f *filesLogWriter) Init(config string) error {
return nil
}

func (f *filesLogWriter) Destroy() {
func (f *mulitFileLogWriter) Destroy() {
for i := 0; i < len(f.writers); i++ {
if f.writers[i] != nil {
f.writers[i].Destroy()
}
}
}

func (f *filesLogWriter) WriteMsg(when time.Time, msg string, level int) error {
func (f *mulitFileLogWriter) WriteMsg(when time.Time, msg string, level int) error {
if f.fullLogWriter != nil {
f.fullLogWriter.WriteMsg(when, msg, level)
}
Expand All @@ -98,7 +98,7 @@ func (f *filesLogWriter) WriteMsg(when time.Time, msg string, level int) error {
return nil
}

func (f *filesLogWriter) Flush() {
func (f *mulitFileLogWriter) Flush() {
for i := 0; i < len(f.writers); i++ {
if f.writers[i] != nil {
f.writers[i].Flush()
Expand All @@ -108,7 +108,7 @@ func (f *filesLogWriter) Flush() {

// newFilesWriter create a FileLogWriter returning as LoggerInterface.
func newFilesWriter() Logger {
return &filesLogWriter{}
return &mulitFileLogWriter{}
}

func init() {
Expand Down

0 comments on commit b2f0713

Please sign in to comment.