Skip to content
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

First class support for package in logger and entries #22

Merged
merged 9 commits into from
Aug 7, 2017

Conversation

at15
Copy link
Member

@at15 at15 commented Jul 22, 2017

Fix #21, Fix #20, Fix #16, Fix #3

  • register package using reflection
  • track registered entries in logger
  • support alias of pkg when logging, the application level packages don't need to be that long 70d51ee
  • each entry must have a package 70d51ee
  • support level in each entry 03cc777
    • SetLevel for logger so it can set all the level for registered entries
  • apply filter to each entry statically (might protect by mutex or not? since we are not using pointer receiver for the log method)
  • API for controlling the log level each packages [log] HTTP API for controlling log level for admin #23

at15 added 2 commits July 22, 2017 13:46
- no longer need to manually specify the name of the package
- [ ] TODO: logger itself still have no idea and control of all the registered entries
@at15 at15 added this to the 0.0.2 milestone Jul 22, 2017
@at15 at15 changed the title First class support package in logger and entries [WIP] First class support package in logger and entries Jul 22, 2017
at15 added 5 commits July 23, 2017 21:16
- it is currently using `os.SetEnv`, while using `EnvAsMap` and add the
vars in .env file into the map might be better, it would keep the env
var clean for other tests
- for key only line, the value is set to empty string
- followed https://github.com/motdotla/dotenv , though the idea of .env
is actually from the old days using Laravel @ComMouse
- if environment variable is set, use it, otherwise use default value
- extract username and pwd from Authorization header
- generate the header from username and pwd
@at15 at15 changed the title [WIP] First class support package in logger and entries [WIP] First class support for package in logger and entries Aug 5, 2017
- when filtering `entry.Pkg` is used
- when logging, `fields["pkg"]` is used
- `SetPkgAlias` would update `fields["pkg"]`
- no longer use `entry.Logger.Level` to check if we should log, use
`entry.EntryLevel`
- `SetLevel` on logger would update `entry.EntryLevel` of all the
registered entries
- use bytes.buffer to test logging output with multiwriter
@at15 at15 changed the title [WIP] First class support for package in logger and entries First class support for package in logger and entries Aug 7, 2017
@at15 at15 merged commit 0eca352 into master Aug 7, 2017
@at15 at15 deleted the feature/log/package-support branch August 7, 2017 03:28
@at15 at15 mentioned this pull request Aug 7, 2017
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant