feat: add logging and collector implementations
- Introduced `hertzx` package with `NewHertz` function for server initialization. - Implemented `logx` package with various log collectors: Console, Loki, Elasticsearch, and Prometheus. - Added `Logger` struct to manage logging levels and collectors. - Created environment variable loading functionality in `osx` package to support configuration. - Enhanced logging capabilities with structured log entries and asynchronous collection.
This commit is contained in:
14
hertzx/hz.go
Normal file
14
hertzx/hz.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package hertzx
|
||||
|
||||
import (
|
||||
"git.liteyuki.org/LiteyukiStudio/folium/osx"
|
||||
"github.com/cloudwego/hertz/pkg/app/server"
|
||||
"github.com/cloudwego/hertz/pkg/common/config"
|
||||
)
|
||||
|
||||
func NewHertz(opts ...config.Option) *server.Hertz {
|
||||
opts = append([]config.Option{
|
||||
server.WithHostPorts(osx.GetEnv("HERTZ_HOST_PORT", ":8888")),
|
||||
}, opts...)
|
||||
return server.New(opts...)
|
||||
}
|
||||
Reference in New Issue
Block a user