[![LinkedIn][linkedin-shield]][linkedin-url]
Golang Patterns is commom used interfaces to use in your projects
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
Using this project you can just send log (for example) and don't think about how implementation you'll use. This can be done any time, and can be changed any time too.
go get -u github.com/axpira/gop/log
The implementation will format the output, but you can change anytime implementation.
For now:
- goplogjson Fast and with zero allocation
- adapter Creates a map[string]interface{} with all fields, and you can implements just one func to create a logger. Has Logrus adadapter and Json using Golang encoding
package main
import (
"github.com/axpira/gop/log"
)
func main() {
log.Info("Hello World")
}
package main
import (
"github.com/axpira/gop/log"
"github.com/axpira/gop/log/field"
)
func main() {
log.Inf(field.
Str("str_field", "hello").
Int("int_field", 42).
Msg("Hello World"),
)
}
package main
import (
"errors"
"github.com/axpira/gop/log"
)
func main() {
log.Error("Hello World", errors.New("unknown error"))
}
package main
import (
"errors"
"github.com/axpira/gop/log"
"github.com/axpira/gop/log/field"
)
func main() {
log.Log(
log.ErrorLevel,
field.Msg("Hello World").Err(errors.New("unknown error")),
)
package main
import (
"errors"
"github.com/axpira/gop/log"
"github.com/axpira/gop/log/field"
)
func main() {
l := log.With(field.Str("mykey", "value"))
l.Trace("Hello World")
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Thiago Ferreira - thiagogbferreira@gmail.com
Project Link: https://github.com/axpira/gop