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

Add structured compose printer #6

Open
olehan opened this issue Jul 28, 2019 · 0 comments
Open

Add structured compose printer #6

olehan opened this issue Jul 28, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@olehan
Copy link
Owner

olehan commented Jul 28, 2019

Motivation

Structured Key-Value printer is twice slower than the Template or Base printers, so I have an idea that will fix the problem and get a better logging experience.

Description

Expected function type:

type PrinterComposer interface {
    Interface(key string, value interface{}) PrinterComposer
    String(key string, value string) PrinterComposer
    Int(key string, value int64) PrinterComposer
    Bool(key string, value bool) PrinterComposer
    // And so on...

    // A function that is going to Write to the Writer from a linked buffer.
    Flush() PrinterComposer
}

type PrintSC = func(message string) PrinterComposer

Expected usage:

logger.PrintSC("user info:").
    String("name", "My").
    Int("age", int64(32)).
    Bool("male", true).
    Flush()

The idea is to get type-safe and fast structured logging.

@olehan olehan added the enhancement New feature or request label Jul 28, 2019
@olehan olehan added this to the v0.1.0 milestone Jul 28, 2019
@olehan olehan self-assigned this Jul 28, 2019
@olehan olehan modified the milestones: v0.1.0, v0.2.0 Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant