C is a Go library that provides a context management system with advanced functionality.
go get github.com/gosuit/c- Logging using the sl.Logger.
- Storage of key-value pairs with ability to log values.
- Implementation of context.Context.
package main
import (
"github.com/gosuit/c"
"github.com/gosuit/sl"
)
func main() {
ctx := c.New(sl.Default())
ctx.AddValue("key1", "value1", false)
ctx.AddValue("key2", "value2", true)
some(ctx)
}
func some(ctx c.Context) {
log := ctx.Logger()
log.Info("msg") // result has attribute key2=value2
}Contributions are welcome! Please feel free to submit a pull request or open an issue for any enhancements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.