本文整理汇总了Golang中log/syslog.Writer.Warning方法的典型用法代码示例。如果您正苦于以下问题:Golang Writer.Warning方法的具体用法?Golang Writer.Warning怎么用?Golang Writer.Warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log/syslog.Writer
的用法示例。
在下文中一共展示了Writer.Warning方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: newSyslogAdapter
func newSyslogAdapter(w *syslog.Writer) *LoggingAdapter {
return &LoggingAdapter{
Debugf: func(format string, v ...interface{}) { w.Debug(fmt.Sprintf(format, v...)) },
Infof: func(format string, v ...interface{}) { w.Info(fmt.Sprintf(format, v...)) },
Warnf: func(format string, v ...interface{}) { w.Warning(fmt.Sprintf(format, v...)) },
Errorf: func(format string, v ...interface{}) { w.Err(fmt.Sprintf(format, v...)) },
Fatalf: func(format string, v ...interface{}) {
s := fmt.Sprintf(format, v...)
w.Crit(s)
os.Exit(1)
},
Panicf: func(format string, v ...interface{}) {
s := fmt.Sprintf(format, v...)
w.Emerg(s)
panic(s)
},
}
}
示例2: Gettasks
func Gettasks(makeFlag string, quant int, golog syslog.Writer) {
golog.Info("Start Gettasks")
quantstr := strconv.Itoa(quant)
if res, err := http.Get("http://latest.kannelgo.sinelgamysql.appspot.com/gettasks?makeflag=" + makeFlag + "&tasksquant=" + quantstr); err != nil {
golog.Err(err.Error())
} else {
if data, err := ioutil.ReadAll(res.Body); err != nil {
golog.Err(err.Error())
} else {
sliceforjson := make([]d.Smsout, 2)
json.Unmarshal(data, &sliceforjson)
var sendok bool
for _, smsout := range sliceforjson {
sendok = false
golog.Info(smsout.Phoneto)
golog.Info(smsout.Opcode)
golog.Info(smsout.Nmake)
sendok = checkaclient.CheckByPhone(smsout.Phoneto)
if sendok {
golog.Info("sendok OK makeFlag " + makeFlag)
if makeFlag == "sms179019" {
// pr.SendSMSKannel(smsout)
// for now elisa
pr.SmsSendBy("elisa", smsout, golog)
// pr.SendSMSCgwSonera(smsout)
// pr.SendSMSSonera(smsout)
} else if makeFlag == "gsm179019" {
// pr.SendSMSSonera(smsout)
pr.SmsSendBy("sonera", smsout, golog)
// pr.SendSMSCgwSonera(smsout) //problems öä
} else if makeFlag == "voicetr" {
golog.Info("send by vocetr")
pr.SmsSendBy("voicetr", smsout, golog)
} else if makeFlag == "sms179029" {
golog.Info("send by pullpull now DNA only")
pr.SmsSendBy("pullpull", smsout, golog)
}
insertsmsins.InsertSmsRecord(smsout.Phoneto, smsout.Text, makeFlag, golog)
} else {
// fmt.Println("Dont't send sms for "+smsout.Phoneto)
golog.Warning("Dont't send sms for " + smsout.Phoneto)
}
}
}
}
}