mirror of
https://github.com/Fishwaldo/go-logadapter.git
synced 2025-03-15 19:31:25 +00:00
Update readme accoridng to godoc
This commit is contained in:
parent
d5e8061910
commit
74ddd4aeb3
1 changed files with 48 additions and 1 deletions
49
README.md
49
README.md
|
@ -1 +1,48 @@
|
|||
# Go Log Adapter
|
||||
# logadapter
|
||||
|
||||
[](https://codecov.io/gh/Fishwaldo/go-logadapter)
|
||||
[](http://pkg.go.dev/github.com/Fishwaldo/go-logadapter)
|
||||
|
||||
## Sub Packages
|
||||
|
||||
* [utils](./utils)
|
||||
|
||||
## Examples
|
||||
|
||||
```golang
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/Fishwaldo/go-logadapter"
|
||||
)
|
||||
|
||||
type TestStruct struct {
|
||||
Logger logadapter.Logger
|
||||
}
|
||||
|
||||
func (t *TestStruct) Init() {
|
||||
temp := logadapter.DefaultLogger()
|
||||
temp.SetLevel(logadapter.LOG_TRACE)
|
||||
t.Logger = temp
|
||||
}
|
||||
|
||||
func (t *TestStruct) LogSomething() {
|
||||
t.Logger.Info("This is a message")
|
||||
}
|
||||
|
||||
func (t *TestStruct) StructuredLog() {
|
||||
t.Logger.With("Test", "Message").Trace("Hello %s", string("world"))
|
||||
}
|
||||
|
||||
func main() {
|
||||
ts := TestStruct{}
|
||||
ts.Init()
|
||||
ts.LogSomething()
|
||||
ts.StructuredLog()
|
||||
ts.Logger.Warn("This is outside the Structure")
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
Readme created from Go doc with [goreadme](https://github.com/posener/goreadme)
|
||||
|
|
Loading…
Add table
Reference in a new issue