36 lines
998 B
Go
36 lines
998 B
Go
package hlog
|
|
|
|
import "runtime"
|
|
|
|
// EZConfIntegration provides integration with ezconf for automatic configuration
|
|
type EZConfIntegration struct{}
|
|
|
|
// PackagePath returns the path to the hlog package for source parsing
|
|
func (e EZConfIntegration) PackagePath() string {
|
|
_, filename, _, _ := runtime.Caller(0)
|
|
// Return directory of this file
|
|
return filename[:len(filename)-len("/ezconf.go")]
|
|
}
|
|
|
|
// ConfigFunc returns the ConfigFromEnv function for ezconf
|
|
func (e EZConfIntegration) ConfigFunc() func() (interface{}, error) {
|
|
return func() (interface{}, error) {
|
|
return ConfigFromEnv()
|
|
}
|
|
}
|
|
|
|
// Name returns the name to use when registering with ezconf
|
|
func (e EZConfIntegration) Name() string {
|
|
return "hlog"
|
|
}
|
|
|
|
// GroupName returns the display name for grouping environment variables
|
|
func (e EZConfIntegration) GroupName() string {
|
|
return "HLog"
|
|
}
|
|
|
|
// NewEZConfIntegration creates a new EZConf integration helper
|
|
func NewEZConfIntegration() EZConfIntegration {
|
|
return EZConfIntegration{}
|
|
}
|