Skip to content

*: 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

Merged
merged 2 commits into from
Jan 29, 2019
Merged

*: supports Unifiled Log Format #1

merged 2 commits into from
Jan 29, 2019

Conversation

nolouch
Copy link
Member

@nolouch nolouch commented Jan 24, 2019

Signed-off-by: nolouch nolouch@gmail.com
supports Unified Log Format

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() {
Copy link
Member

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?

Copy link
Member Author

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>
Copy link
Member

@breezewish breezewish left a 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 {
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

@rleungx rleungx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@nolouch nolouch merged commit 6afc545 into master Jan 29, 2019
@nolouch nolouch deleted the log-format branch January 29, 2019 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants