New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] Log filter #59

Closed
at15 opened this Issue Dec 16, 2016 · 3 comments

Comments

Projects
None yet
1 participant
@at15
Copy link
Member

at15 commented Dec 16, 2016

Transferred, see dyweb/gommon#3 for updates

Since logrus does not provide much for log filter by tag, the hook only get message filtered by tag and can't stop the log from being logged, and Xephon also need this xephonhq/xephon-b#26, lab needs this as well at15/6.824#4

  • separate package for common use
  • re implement basic logging
  • log with field
  • log to stdout
  • log to file
  • needed functionality from logrus
  • filter by field

Ref

@at15 at15 added the type/refactor label Dec 16, 2016

@at15 at15 added this to the 0.1.0 milestone Dec 16, 2016

@at15 at15 self-assigned this Dec 16, 2016

at15 added a commit that referenced this issue Dec 16, 2016

@at15 at15 referenced this issue Dec 16, 2016

Merged

[partial][common] log #60

3 of 3 tasks complete

@at15 at15 added the status/working label Dec 16, 2016

@at15

This comment has been minimized.

Copy link
Member Author

at15 commented Dec 17, 2016

In logrus, the real log part is not using pointer in order to avoid race condition

// This function is not declared with a pointer value because otherwise
// race conditions will occur when using multiple goroutines
func (entry Entry) log(level Level, msg string) {
        var buffer *bytes.Buffer
	entry.Time = time.Now()
	entry.Level = level
	entry.Message = msg

It is solved in at15/go-learning#3, the log function modify the attributes of the Entry, so it use object receiver instead of pointer receiver, and it only locks the logger, does not lock the entry

at15 added a commit that referenced this issue Dec 17, 2016

@at15

This comment has been minimized.

Copy link
Member Author

at15 commented Dec 18, 2016

Found a bug in logrus, this function is not accurate, since entry have a bunch of hook executed before it is logged into terminal, this miniTS should compare with entry.Time instead of current time. If I add a hook that sleep, it should show problem

func miniTS() int {
	return int(time.Since(baseTimestamp) / time.Second)
}

created an issue for this sirupsen/logrus#457

@at15 at15 referenced this issue Dec 18, 2016

Closed

filter log by package like in java's logback #26

1 of 3 tasks complete

@at15 at15 added type/backlog and removed status/working labels Dec 18, 2016

@at15 at15 referenced this issue Dec 20, 2016

Open

[Refactor] Move command runner to common #63

0 of 8 tasks complete

@at15 at15 modified the milestones: 0.0.4, 0.1.0 Dec 22, 2016

@at15 at15 added status/tranferred and removed type/backlog labels Jan 7, 2017

@at15 at15 referenced this issue Jan 7, 2017

Closed

[log] Add config for log filtering #3

0 of 2 tasks complete

@dyweb dyweb locked and limited conversation to collaborators Jan 7, 2017

@at15

This comment has been minimized.

Copy link
Member Author

at15 commented Dec 17, 2017

working on v2 version in dyweb/gommon dyweb/gommon#28

@at15 at15 closed this Dec 17, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.