Skip to content

Why not close millCh when close Logger #219

@zxhio

Description

@zxhio

When the program only needs one Logger, it works fine; however, when the program needs multiple Loggers, or the Logger is dynamic, the millCh will not be released, resulting in a goroutine leak.

#57 #80 #100 There already see 3 issues, so as a general purpose log rotation library, why not fix this?

millCh never close

func (l *Logger) millRun() {
	for range l.millCh {
		// what am I going to do, log this?
		_ = l.millRunOnce()
	}
}

func (l *Logger) Close() error {
	l.mu.Lock()
	defer l.mu.Unlock()
	return l.close()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions