当前位置: 首页>>代码示例>>Golang>>正文


Golang Writer.Warning方法代码示例

本文整理汇总了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)
		},
	}
}
开发者ID:flier,项目名称:go.server,代码行数:22,代码来源:logging.go

示例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)
				}
			}

		}
	}
}
开发者ID:sinelga,项目名称:KannelGoInt,代码行数:73,代码来源:gettasks.go


注:本文中的log/syslog.Writer.Warning方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。