本文整理汇总了Golang中github.com/juju/juju/utils/syslog.SyslogConfig类的典型用法代码示例。如果您正苦于以下问题:Golang SyslogConfig类的具体用法?Golang SyslogConfig怎么用?Golang SyslogConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SyslogConfig类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: assertRsyslogConfigContents
func (s *syslogConfigSuite) assertRsyslogConfigContents(c *gc.C, slConfig *syslog.SyslogConfig, expectedConf string) {
data, err := slConfig.Render()
c.Assert(err, jc.ErrorIsNil)
if len(data) == 0 {
c.Fatal("got empty data from render")
}
d := string(data)
if d != expectedConf {
diff(c, d, expectedConf)
c.Fail()
}
}
开发者ID:claudiu-coblis,项目名称:juju,代码行数:12,代码来源:config_test.go
示例2: newRsyslogConfigHandler
func newRsyslogConfigHandler(st *apirsyslog.State, mode RsyslogMode, tag, namespace string, stateServerAddrs []string) (*RsyslogConfigHandler, error) {
var syslogConfig *syslog.SyslogConfig
if mode == RsyslogModeAccumulate {
syslogConfig = syslog.NewAccumulateConfig(
tag, logDir, 0, namespace, stateServerAddrs,
)
} else {
syslogConfig = syslog.NewForwardConfig(
tag, logDir, 0, namespace, stateServerAddrs,
)
}
// Historically only machine-0 includes the namespace in the log
// dir/file; for backwards compatibility we continue the tradition.
if tag != "machine-0" {
namespace = ""
}
kind, err := names.TagKind(tag)
if err != nil {
return nil, err
}
if kind == names.MachineTagKind {
if namespace == "" {
syslogConfig.ConfigFileName = "25-juju.conf"
} else {
syslogConfig.ConfigFileName = fmt.Sprintf("25-juju-%s.conf", namespace)
}
} else {
syslogConfig.ConfigFileName = fmt.Sprintf("26-juju-%s.conf", tag)
}
syslogConfig.ConfigDir = rsyslogConfDir
syslogConfig.LogDir = logDir
if namespace != "" {
syslogConfig.LogDir += "-" + namespace
}
return &RsyslogConfigHandler{
st: st,
mode: mode,
syslogConfig: syslogConfig,
tag: tag,
}, nil
}
开发者ID:rogpeppe,项目名称:juju,代码行数:43,代码来源:worker.go
示例3: newRsyslogConfigHandler
func newRsyslogConfigHandler(st *apirsyslog.State, mode RsyslogMode, tag names.Tag, namespace string, stateServerAddrs []string) (*RsyslogConfigHandler, error) {
var syslogConfig *syslog.SyslogConfig
if mode == RsyslogModeAccumulate {
syslogConfig = syslog.NewAccumulateConfig(tag.String(), logDir, 0, namespace, stateServerAddrs)
} else {
syslogConfig = syslog.NewForwardConfig(tag.String(), logDir, 0, namespace, stateServerAddrs)
}
// Historically only machine-0 includes the namespace in the log
// dir/file; for backwards compatibility we continue the tradition.
if tag != names.NewMachineTag("0") {
namespace = ""
}
switch tag := tag.(type) {
case names.MachineTag:
if namespace == "" {
syslogConfig.ConfigFileName = "25-juju.conf"
} else {
syslogConfig.ConfigFileName = fmt.Sprintf("25-juju-%s.conf", namespace)
}
default:
syslogConfig.ConfigFileName = fmt.Sprintf("26-juju-%s.conf", tag)
}
syslogConfig.ConfigDir = rsyslogConfDir
syslogConfig.LogDir = logDir
if namespace != "" {
syslogConfig.LogDir += "-" + namespace
}
return &RsyslogConfigHandler{
st: st,
mode: mode,
syslogConfig: syslogConfig,
tag: tag,
}, nil
}
开发者ID:jiasir,项目名称:juju,代码行数:36,代码来源:worker.go
示例4: assertRsyslogConfigPath
func (s *syslogConfigSuite) assertRsyslogConfigPath(c *gc.C, slConfig *syslog.SyslogConfig) {
slConfig.ConfigDir = s.configDir
slConfig.ConfigFileName = "rsyslog.conf"
c.Assert(slConfig.ConfigFilePath(), gc.Equals, filepath.Join(s.configDir, "rsyslog.conf"))
}
开发者ID:claudiu-coblis,项目名称:juju,代码行数:5,代码来源:config_test.go
示例5: assertRsyslogConfigContents
func (s *syslogConfigSuite) assertRsyslogConfigContents(c *gc.C, slConfig *syslog.SyslogConfig,
expectedConf string) {
data, err := slConfig.Render()
c.Assert(err, gc.IsNil)
c.Assert(string(data), gc.Equals, expectedConf)
}
开发者ID:jiasir,项目名称:juju,代码行数:6,代码来源:config_test.go
注:本文中的github.com/juju/juju/utils/syslog.SyslogConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论