An open API service indexing awesome lists of open source software.

https://github.com/gosuit/c

Extended Context
https://github.com/gosuit/c

context golang logging

Last synced: 10 months ago
JSON representation

Extended Context

Awesome Lists containing this project

README

          

# C

C is a Go library that provides a context management system with advanced functionality.

## Installation

```zsh
go get github.com/gosuit/c
```

## Features

- Logging using the sl.Logger.
- Storage of key-value pairs with ability to log values.
- Implementation of context.Context.

## Usage

```golang
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
}
```

## Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any enhancements or bug fixes.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.