olehan / kek Goto Github PK
View Code? Open in Web Editor NEW๐ Zero allocated, structured, leveled and very pretty Golang logger
License: MIT License
๐ Zero allocated, structured, leveled and very pretty Golang logger
License: MIT License
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.
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.
Describe the bug
FormatterUtils.StringifyByTemplate
function can not format when the template string contains two (or more) value points at a row. Instead of the following format, the output will miss every second value point, so the format "{}{}{}{}"
will be formatted as "value{}value{}"
.
To Reproduce
Steps to reproduce the behavior:
StringifyByTemplate
in any of tests with the template string "{}{}{}{}"
Expected behavior
Values should be written into a buffer as expected by the template string.
For example []interface{}{"v", 1, true, 1.1}
should format to "v1true1.1" if the template string is "{}{}{}{}"
Not really sure when I can do it, but I plan to rent a dedicated server and create some gud benchmarks, so you could see the clear performance of the lib.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.