Documentation
¶
Index ¶
- func InitDefaultProviders()
- func Logger(logID string) logging.LoggingProvider
- func Meter(ctx context.Context, metric string, args ...string)
- func NewHttpContext(req *h.Request) context.Context
- func NewTask(task tasks.HttpTask) error
- func ReportError(e error)
- type InstanceProviderFunc
- type Platform
- type PlatformOpts
- type ProviderType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitDefaultProviders ¶ added in v0.9.3
func InitDefaultProviders()
func Logger ¶
func Logger(logID string) logging.LoggingProvider
Logger returns a logger instance identified by ID
func NewHttpContext ¶
NewHttpContext creates a new Http context for request req
func ReportError ¶
func ReportError(e error)
ReportError reports error e using the current platform's error reporting provider
Types ¶
type InstanceProviderFunc ¶
type InstanceProviderFunc func(string) interface{}
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
func DefaultPlatform ¶ added in v0.9.3
func DefaultPlatform() *Platform
DefaultPlatform returns the current default platform provider
func InitPlatform ¶
func InitPlatform(ctx context.Context, opts ...PlatformOpts) (*Platform, error)
InitPlatform creates a new platform instance and configures it with providers
func RegisterPlatform ¶
RegisterPlatform makes p the new default platform provider
type PlatformOpts ¶
type PlatformOpts struct {
ID string
Type ProviderType
Impl InstanceProviderFunc
}
var ( DefaultLoggingConfig PlatformOpts = PlatformOpts{ID: "platform.default.logger", Type: ProviderTypeLogger, Impl: local.NewDefaultLoggingProvider} DefaultErrorReportingConfig PlatformOpts = PlatformOpts{ID: "platform.default.errorreporting", Type: ProviderTypeErrorReporter, Impl: local.NewDefaultErrorReportingProvider} DefaultContextConfig PlatformOpts = PlatformOpts{ID: "platform.default.context", Type: ProviderTypeHttpContext, Impl: local.NewDefaultContextProvider} DefaultTaskConfig PlatformOpts = PlatformOpts{ID: "platform.default.task", Type: ProviderTypeTask, Impl: local.NewDefaultTaskProvider} DefaultMetricsConfig PlatformOpts = PlatformOpts{ID: "platform.default.metrics", Type: ProviderTypeMetrics, Impl: local.NewDefaultMetricsProvider} )
type ProviderType ¶
type ProviderType int
const ( ProviderTypeLogger ProviderType = iota ProviderTypeErrorReporter ProviderTypeHttpContext ProviderTypeTask ProviderTypeMetrics )
func (ProviderType) String ¶
func (l ProviderType) String() string
Returns the name of a provider type
Click to show internal directories.
Click to hide internal directories.