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


Golang Writer.Err方法代码示例

本文整理汇总了Golang中log/syslog.Writer.Err方法的典型用法代码示例。如果您正苦于以下问题:Golang Writer.Err方法的具体用法?Golang Writer.Err怎么用?Golang Writer.Err使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在log/syslog.Writer的用法示例。


在下文中一共展示了Writer.Err方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: GetMapAclients

func GetMapAclients(db autorc.Conn, sqlstr string, makeFlag string, golog syslog.Writer) []d.Aclient {

	var aclientsmap []d.Aclient

	if stmt, err := db.Prepare(sqlstr); err != nil {

		golog.Err(err.Error())

	} else {

		if rows, res, err := stmt.Exec(); err != nil {

			golog.Err(err.Error())

		} else {

			aclientsmap = make([]d.Aclient, len(rows))

			for i, row := range rows {

				aclientsmap[i].Id = row.Int(res.Map("id"))
				aclientsmap[i].Phone = row.Str(res.Map("phone"))
				aclientsmap[i].Opcode = row.Str(res.Map("opcode"))
				aclientsmap[i].Nmake = makeFlag
				aclientsmap[i].Nupdatemake = row.Localtime(res.Map("nupdate_make"))

			}

		}
	}

	return aclientsmap

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

示例2: apiGet

func apiGet(s *mgo.Session, label string, todo string, mlog *syslog.Writer) string {
	if len(label) == 0 {
		return ""
	}

	list, err := dbQuery(s, label)
	if err != nil {
		mlog.Err("Error: db query went bad: " + err.Error())
		return "Error"
	}

	todos := make([]TodoItem, len(list))
	count := 0
	for i, todo := range list {
		todos[i].Text = todo.Text
		todos[i].Id = todo.Id.Hex()
		count += 1
	}
	jsonOut := struct {
		Label string
		Count int
		Todos []TodoItem
	}{label, count, todos}

	out, err := json.MarshalIndent(jsonOut, "", "  ")
	if err != nil {
		mlog.Err("Error: could not properly construct json")
		return "Error"
	}
	return string(out)
}
开发者ID:hspak,项目名称:gogobbles,代码行数:31,代码来源:api.go

示例3: GetSqlMainosTel

func GetSqlMainosTel(golog syslog.Writer, db sql.DB, sqlstr string) []domains.MainosTel {
	var result []domains.MainosTel

	rows, err := db.Query(sqlstr)
	if err != nil {
		golog.Err(err.Error())
	}
	defer rows.Close()

	for rows.Next() {

		var phone string
		var smstext string
		err := rows.Scan(&phone, &smstext)
		if err != nil {
			golog.Err(err.Error())
		}

		var mainostel domains.MainosTel

		if !strings.HasPrefix(phone, "09") && !strings.Contains(phone, "070057") {

			mainostel.Phone = phone
			mainostel.Text = smstext
			result = append(result, mainostel)

		}

	}
	return result
}
开发者ID:sinelga,项目名称:KannelGoInt,代码行数:31,代码来源:sql2.go

示例4: apiCount

func apiCount(s *mgo.Session, mlog *syslog.Writer) string {
	itemCount, listCount, err := dbCountLists(s)
	var countOut struct {
		ItemCount int
		List      []struct {
			Label string
			Count int
		}
	}

	countOut.ItemCount = listCount
	countOut.List = make([]struct {
		Label string
		Count int
	}, len(itemCount))
	i := 0
	for k, v := range itemCount {
		countOut.List[i].Label = k
		countOut.List[i].Count = v
		i += 1
	}

	out, err := json.MarshalIndent(countOut, "", "  ")
	if err != nil {
		mlog.Err("Error: could not properly construct json")
		return "Error"
	}
	return string(out)
}
开发者ID:hspak,项目名称:gogobbles,代码行数:29,代码来源:api.go

示例5: xmlcheck

func xmlcheck(golog syslog.Writer, provider string, phone string, data []byte) {

	//	log.Println("GetUrl:xmlcheck check provider ", provider, "phone", phone)
	//
	//	<SmsResponse>
	//        <version>1</version>
	//        <result>1</result>
	//        <resultstring>success</resultstring>
	//        <description></description>
	//        <partcount>1</partcount>
	//        <endcause></endcause>
	//</SmsResponse>

	v := Dataxml{}
	err := xml.Unmarshal(data, &v)
	if err != nil {
		//		fmt.Printf("error: %v", err)
		golog.Err(err.Error())

		blockphone(phone)

	} else {

		//		fmt.Printf("Result: %q\n", v.Result)
		golog.Info(v.Result)

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

示例6: apiRemove

func apiRemove(s *mgo.Session, label string, id string, mlog *syslog.Writer) string {
	if len(label) == 0 {
		return ""
	}

	err := dbRemove(s, label, MongoTodo{Id: bson.ObjectIdHex(id), Text: ""})
	if err != nil {
		mlog.Err("Error: db remove went bad: " + err.Error())
		return "Error"
	}
	return "Removing: " + id + " from: " + label
}
开发者ID:hspak,项目名称:gogobbles,代码行数:12,代码来源:api.go

示例7: apiAdd

func apiAdd(s *mgo.Session, label string, todo string, mlog *syslog.Writer) string {
	if len(label) == 0 {
		return ""
	}

	newTodo := MongoTodo{Id: bson.NewObjectId(), Text: todo}
	err := dbInsert(s, label, newTodo)
	if err != nil {
		mlog.Err("Error: db insert went bad: " + err.Error())
		return "Error"
	}
	return newTodo.Id.Hex()
}
开发者ID:hspak,项目名称:gogobbles,代码行数:13,代码来源:api.go

示例8: GetLastMainos

func GetLastMainos() {

	var golog syslog.Writer
	var config domains.Config

	confstr := config.Database.User + ":" + config.Database.Passwd + "@/" + config.Database.Database + "?parseTime=true"

	db, err := sql.Open("mysql", confstr)
	if err != nil {
		golog.Err(err.Error())
	}
	defer db.Close()

	sql2.GetSqlMainosTel(golog, *db, "select count(*) from calls where cdate>=curdate()")

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

示例9: InsertSmsRecord

func InsertSmsRecord(db autorc.Conn, sqlstr string, golog syslog.Writer) {

	if stmt, err := db.Prepare(sqlstr); err != nil {

		golog.Err(err.Error())

	} else {
		if _, _, err := stmt.Exec(); err != nil {

			golog.Err(err.Error())

		}

	}

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

示例10: UpdateAclient

func UpdateAclient(golog syslog.Writer, db sql.DB, sqlstr string) {

	if stmt, err := db.Prepare(sqlstr); err != nil {

		golog.Err(err.Error())

	} else {

		if _, err := stmt.Exec(); err != nil {

			golog.Err(err.Error())

		} else {

			golog.Info("Aclient updated")

		}

	}

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

示例11: InsertMobileClient

func InsertMobileClient(golog syslog.Writer, db sql.DB, sqlstr string) {

	if stmt, err := db.Prepare(sqlstr); err != nil {

		golog.Err(err.Error())

	} else {

		if _, err := stmt.Exec(); err != nil {

			golog.Err(err.Error())

		} else {

			golog.Info("New Client arrived!!!")

		}

	}

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

示例12: 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

示例13: GetMobileClientId

func GetMobileClientId(golog syslog.Writer, db sql.DB, sqlstr string) int {

	var cliID int

	rows, err := db.Query(sqlstr)
	if err != nil {
		golog.Err(err.Error())
	}
	defer rows.Close()

	for rows.Next() {

		err := rows.Scan(&cliID)
		if err != nil {
			golog.Err(err.Error())
		}

	}

	return cliID

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

示例14: GetSqlInt

func GetSqlInt(golog syslog.Writer, db sql.DB, sqlstr string) int {

	var result int

	rows, err := db.Query(sqlstr)
	if err != nil {
		golog.Err(err.Error())
	}
	defer rows.Close()

	for rows.Next() {

		err := rows.Scan(&result)
		if err != nil {
			golog.Err(err.Error())
		}

	}

	return result

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

示例15: GetUrl

func GetUrl(golog syslog.Writer, provider string, phone string, urlstr string) {

	if res, err := http.Get(urlstr); err != nil {
		log.Fatalf("Get: %v", err)
		golog.Err(err.Error())
	} else {

		if data, err := ioutil.ReadAll(res.Body); err != nil {

			log.Fatalf("Get: %v", err)
			golog.Err(err.Error())

		} else {
			//			fmt.Printf("out %s", string(data))

			if provider == "voicetr" {

				xmlcheck(golog, provider, phone, data)

			}

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


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