本文整理汇总了Golang中github.com/xh3b4sd/anna/log.DefaultConfig函数的典型用法代码示例。如果您正苦于以下问题:Golang DefaultConfig函数的具体用法?Golang DefaultConfig怎么用?Golang DefaultConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DefaultConfig函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: DefaultConfig
// DefaultConfig provides a default configuration to create a new server object
// by best effort.
func DefaultConfig() Config {
newInstrumentation, err := memory.NewInstrumentation(memory.DefaultInstrumentationConfig())
if err != nil {
panic(err)
}
newLogControl, err := logcontrol.NewControl(logcontrol.DefaultControlConfig())
if err != nil {
panic(err)
}
newTextInterface, err := text.NewServer(text.DefaultServerConfig())
if err != nil {
panic(err)
}
newConfig := Config{
// Dependencies.
Instrumentation: newInstrumentation,
Log: log.New(log.DefaultConfig()),
LogControl: newLogControl,
TextInterface: newTextInterface,
// Settings.
GRPCAddr: "127.0.0.1:9119",
HTTPAddr: "127.0.0.1:9120",
}
return newConfig
}
示例2: DefaultConfig
// DefaultConfig provides a default configuration to create a new command line
// object by best effort.
func DefaultConfig() Config {
newLogControl, err := logcontrol.NewControl(logcontrol.DefaultControlConfig())
if err != nil {
panic(err)
}
newTextInterface, err := text.NewClient(text.DefaultClientConfig())
if err != nil {
panic(err)
}
newConfig := Config{
// Dependencies.
Log: log.New(log.DefaultConfig()),
LogControl: newLogControl,
ServiceCollection: service.MustNewCollection(),
TextInterface: newTextInterface,
// Settings.
Flags: Flags{},
SessionID: string(id.MustNewID()),
Version: version,
}
return newConfig
}
示例3: DefaultStorageConfig
// DefaultStorageConfig provides a default configuration to create a new memory
// storage object by best effort.
func DefaultStorageConfig() StorageConfig {
newConfig := StorageConfig{
// Dependencies.
Log: log.New(log.DefaultConfig()),
}
return newConfig
}
示例4: DefaultServerConfig
// DefaultServerConfig provides a default configuration to create a new text
// interface object by best effort.
func DefaultServerConfig() ServerConfig {
newConfig := ServerConfig{
Log: log.New(log.DefaultConfig()),
ServiceCollection: service.MustNewCollection(),
}
return newConfig
}
示例5: DefaultConfig
// DefaultConfig provides a default configuration to create a new CLG object by
// best effort.
func DefaultConfig() Config {
newConfig := Config{
// Dependencies.
ServiceCollection: service.MustNewCollection(),
Log: log.New(log.DefaultConfig()),
StorageCollection: storage.MustNewCollection(),
}
return newConfig
}
示例6: DefaultConfig
// DefaultConfig provides a default configuration to create a new CLG
// collection object by best effort.
func DefaultConfig() Config {
newIDService, err := id.New(id.DefaultConfig())
if err != nil {
panic(err)
}
newConfig := Config{
// Dependencies.
IDService: newIDService,
Log: log.New(log.DefaultConfig()),
}
return newConfig
}
示例7: DefaultConfig
// DefaultConfig provides a default configuration to create a new network
// object by best effort.
func DefaultConfig() Config {
newConfig := Config{
// Dependencies.
Activator: activator.MustNew(),
ServiceCollection: service.MustNewCollection(),
Forwarder: forwarder.MustNew(),
Log: log.New(log.DefaultConfig()),
StorageCollection: storage.MustNewCollection(),
Tracker: tracker.MustNew(),
// Settings.
Delay: 0,
}
return newConfig
}
示例8: Test_RedisStorage_retryErrorLogger
func Test_RedisStorage_retryErrorLogger(t *testing.T) {
newRootLogger := testMustNewRootLogger(t)
newLogConfig := log.DefaultConfig()
newLogConfig.RootLogger = newRootLogger
newLog := log.New(newLogConfig)
newConfig := DefaultStorageConfig()
newConfig.Log = newLog
newStorage, err := NewStorage(newConfig)
if err != nil {
t.Fatal("expected", nil, "got", err)
}
newStorage.(*storage).retryErrorLogger(invalidConfigError, 0)
result := newRootLogger.(*rootLogger).ArgsToString()
if !strings.Contains(result, invalidConfigError.Error()) {
t.Fatal("expected", invalidConfigError.Error(), "got", result)
}
}
示例9: DefaultControlConfig
// DefaultControlConfig provides a default configuration to create a new log control
// object by best effort.
func DefaultControlConfig() ControlConfig {
return ControlConfig{
// Dependencies.
Log: log.New(log.DefaultConfig()),
}
}