-
Notifications
You must be signed in to change notification settings - Fork 30
*: supports Unifiled Log Format #1
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
Conversation
d73696a
to
b03a209
Compare
Signed-off-by: nolouch <nolouch@gmail.com>
// initFileLog initializes file based logging options. | ||
func initFileLog(cfg *FileLogConfig) (*lumberjack.Logger, error) { | ||
if st, err := os.Stat(cfg.Filename); err == nil { | ||
if st.IsDir() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check if the file has already existed or it is writable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will processed by lumberjack
.
Signed-off-by: nolouch <nolouch@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine
Get = _pool.Get | ||
) | ||
|
||
func getTextEncoder() *textEncoder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need a pool for the encoder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes we need cloned
to create a temp encoder, so use a pool to reduce allocation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Signed-off-by: nolouch nolouch@gmail.com
supports Unified Log Format