當前位置: 首頁>>代碼示例>>Golang>>正文


Golang utils.GetLog函數代碼示例

本文整理匯總了Golang中utils.GetLog函數的典型用法代碼示例。如果您正苦於以下問題:Golang GetLog函數的具體用法?Golang GetLog怎麽用?Golang GetLog使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetLog函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: GetComplainList

//獲取投訴列表
func GetComplainList(filter map[string]interface{}) (compalins []*models.JobComplaint, cnt int64, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.GetList : error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.job.GetList : debug : filter=%s, compalints=%v", utils.Sdump(filter), utils.Sdump(compalins))
		}
	}()

	q := models.GetDB().QueryTable("job_complaints").OrderBy("-created").RelatedSel("Job", "User", "Project", "Employee")

	//按照傳入的條件進行過濾查詢結果
	for k, v := range filter {
		if k != "limit" && k != "offset" && v != "" {
			q = q.Filter(k, v)
		}
	}
	cnt, _ = q.Count()

	if filter["limit"] != nil {
		q = q.Limit(filter["limit"].(int))
	}

	if filter["offset"] != nil {
		q = q.Offset(filter["offset"].(int))
	}

	_, err = q.All(&compalins)

	return

}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:33,代碼來源:complaint.go

示例2: Do

func (pr *PasswordModify) Do() (err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("accountSrv.PasswordReset.Do : %s", err.Error())
		} else {
			utils.GetLog().Debug("accountSrv.PasswordReset.Do : pr %v", pr)
		}
	}()

	if !pr.newPasswordConfirm() {
		return ErrPasswordNotSame
	}

	if err = pr.newPasswordValid(); err != nil {
		return err
	}

	if !pr.oldPasswordValid() {
		return ErrOldPassword
	}

	if err = pr.updatePassword(); err != nil {
		return err
	}
	return nil
}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:26,代碼來源:reset_password.go

示例3: Do

func (ja *JobAssignment) Do() (err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("job.JobAssignment.Do : error = %s, ojb= %s", err.Error(), utils.Sdump(ja))
		}
		utils.GetLog().Debug("job.JobAssignment.Do : ojb= %s", utils.Sdump(ja))
	}()

	if ja.jobAssign.Job, err = ja.getJob(); err != nil {
		return
	}

	if ja.jobAssign.FromUser, err = ja.getFromUser(); err != nil {
		return
	}

	if ja.jobAssign.ToUser, err = ja.getToUser(); err != nil {
		return
	}

	if ja.jobAssign.Remark, err = ja.getRemark(); err != nil {
		return
	}

	if err = ja.jobAssign.Insert(); err != nil {
		return
	}

	if err = ja.afterAssignment(); err != nil {
		return
	}

	return
}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:34,代碼來源:assign.go

示例4: AddHistory

func AddHistory(j *models.Job, user *models.User, isCreate bool) (jid uint, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.AddHistory : error : %s, ", err.Error())
		} else {
			utils.GetLog().Debug("services.job.AddHistory : debug : Job=%s", utils.Sdump(j))
		}
	}()

	var jh models.JobHistory
	jh.Job = j
	jh.IsCreate = isCreate
	jh.Code = j.Code
	jh.CreateUser = j.CreateUser
	jh.Project = j.Project
	jh.Employee = j.Employee
	jh.Type = j.Type
	jh.Department = j.Department
	jh.Target = j.Target
	jh.TargetUrl = j.TargetUrl
	jh.Desc = j.Desc
	jh.Message = j.Message
	jh.FinishTime = j.FinishTime
	jh.ValidTime = j.ValidTime
	jh.ClaimTime = j.ClaimTime
	jh.ValidStatus = j.ValidStatus
	jh.ClaimStatus = j.ClaimStatus
	jh.SubmitStatus = j.SubmitStatus

	var insertId int64
	insertId, err = models.GetDB().Insert(&jh)
	jid = uint(insertId)

	return
}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:35,代碼來源:job_utils.go

示例5: do

func (userList *UserList) do() *UserList {
	if userList.isDo {
		return userList
	}
	userList.isDo = true

	var err error
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.user.GetList : error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.user.GetList : debug : users=%v", utils.Sdump(userList.users))
		}
	}()

	q := models.GetDB().QueryTable("users").RelatedSel("Company")
	if !userList.includeDel {
		q = q.Filter("deleted__isnull", true)
	}

	for k, v := range userList.filter {
		if k != "limit" && k != "offset" && v != "" {
			q = q.Filter(k, v)
		} else if k == "limit" {
			limit := v.(int)
			if limit < 0 {
				limit = 10
			}
			q = q.Limit(limit)
		} else if k == "offset" {
			limit := userList.filter["limit"].(int)
			if limit < 0 {
				limit = 10
			}

			offset := v.(int)
			if offset > 0 {
				offset = (offset - 1) * limit
			}
			q = q.Offset(offset)
		}
	}

	userList.count, _ = q.Count()
	_, err = q.All(&userList.users)
	if err != nil {
		return userList
	}

	return userList
}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:51,代碼來源:user_list.go

示例6: GetTodayJobCount

func GetTodayJobCount() (cnt int64) {
	var err error
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.GetTodayJobCount : error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.job.GetTodayJobCount : count=%v", cnt)
		}
	}()

	q := models.GetDB().QueryTable(models.TABLE_NAME_JOB).Filter("created__gte", time.Now().Format("2006-01-02"))
	cnt, err = q.Count()

	return
}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:15,代碼來源:job_utils.go

示例7: CreateComplian

func (cp *ComplaintCreator) CreateComplian(mapComplain map[string]interface{}, user *models.User) (complainId, jobId uint, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.complain.Create : error : %s, ", err.Error())
		} else {
			utils.GetLog().Debug("services.complain.Create : debug : mapComplain=%s", utils.Sdump(mapComplain))
		}
	}()

	var complian models.JobComplaint
	pid, _ := mapComplain["JobId"].(string)

	filter := make(map[string]interface{})
	filter["id"] = pid

	var job *models.Job
	job, err = GetOneJob(filter)
	complian.Job = &models.Job{Id: job.Id}
	complian.Project = &models.Project{Id: job.Project.Id}

	if mapComplain["employee_id"] != nil {
		employId, _ := strconv.Atoi(mapComplain["employee_id"].(string))
		complian.Employee = &models.User{Id: uint(employId)}
	}
	complian.Complain = mapComplain["Complain"].(string)
	complian.Source = mapComplain["source"].(string)
	complian.Type = mapComplain["Type"].(string)
	response, _ := mapComplain["response"].(int)
	complian.Response = uint(response)
	if mapComplain["editstatus"] != nil {
		editStatus, _ := strconv.Atoi(mapComplain["editstatus"].(string))
		complian.EditStatus = uint(editStatus)
	}

	complian.User = user

	//cp.compliant = complian
	var insertId int64
	insertId, err = models.GetDB().Insert(&complian)
	if err != nil {
		utils.GetLog().Debug("services.complian.Create : debug : job=%s", utils.Sdump(complian))
		return
	}
	complainId = uint(insertId)
	jobId = uint(job.Id)
	return

}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:48,代碼來源:complaint_create.go

示例8: Do

func (c *Creation) Do() (err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("user.Creatin.Do : err = %v , obj = %s ", err, c)
		}
	}()

	if err = c.valid(); err != nil {
		return
	}

	c.password.GenSalt()
	c.password.GenPwd()

	u := models.User{
		Name:          c.name,
		Email:         c.email.EmailAddress(),
		Password:      c.password.Encryped(),
		Salt:          c.password.Salt(),
		Company:       &models.Company{Id: uint(c.companyId)},
		Roles:         c.roles.String(),
		LastLoginTime: time.Now(),
	}

	models.GetDB().Insert(&u)

	return
}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:28,代碼來源:creation.go

示例9: setCurrentUser

func (c *BaseController) setCurrentUser() {
	if !c.isLogin {
		return
	}
	userId := c.GetSession("user_id").(uint)
	var err error

	defer func() {
		if err != nil {
			utils.GetLog().Error("controllers.BaseController.setCurrentUser : NewUserWithId error : userId = %v, noNeedLogin=%v", userId, c.noNeedLogin)
		}
	}()

	if c.currentUser, err = user.NewUserWithId(userId); err != nil {
		if !c.noNeedLogin {
			c.Redirect("/login", 302)
		}
		return
	}
	c.userId = int(userId)

	c.Data["user_info"] = c.currentUser.GetUser()

	c.setUserCookie()
}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:25,代碼來源:base.go

示例10: UpdateProjectStatus

func (p *Project) UpdateProjectStatus(filter map[string]interface{}) (num int64, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.project.UpdateProjectStatus: error : %s", err.Error())
		} else {
			utils.GetLog().Error("services.project updateProjectStatus: debug: filter=%s,id=%v", utils.Sdump(filter))
		}
	}()
	q := models.GetDB().QueryTable(models.TABLE_NAME_PROJECT)
	for k, v := range filter {
		if k == "project_id" {
			num, err = q.Filter("Id", v).Update(orm.Params{"del_status": 1})
		}
	}
	return
}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:16,代碼來源:project.go

示例11: GetCount

func GetCount(filter map[string]interface{}) (cnt int64, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.GetCount : error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.job.GetCount : debug : filter=%s, count=%v", utils.Sdump(filter), cnt)
		}
	}()

	q := models.GetDB().QueryTable(models.TABLE_NAME_JOB)
	for k, v := range filter {
		q = q.Filter(k, v)
	}
	cnt, err = q.Count()

	return
}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:17,代碼來源:job_count.go

示例12: UpdateJobDelStatus

//更新刪除狀態
func (jobList *JobList) UpdateJobDelStatus(filter map[string]interface{}, Delstatus uint) (num int64, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.updateJobDelStatus: error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.job.update: debug: filter=%s,job=%v", utils.Sdump(filter))
		}
	}()

	q := models.GetDB().QueryTable(models.TABLE_NAME_JOB)
	for k, v := range filter {
		if k == "Job_id" {
			num, err = q.Filter("Id", v).Update(orm.Params{"del_status": Delstatus})
		}
	}
	return
}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:18,代碼來源:job.go

示例13: UpdateComplaint

//更新投訴狀態
func UpdateComplaint(filter map[string]interface{}) (num int64, err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.UpdateComplain : error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.job.UpdateComplain : debug : filter=%s, job=%v", utils.Sdump(filter))
		}
	}()

	q := models.GetDB().QueryTable("job_complaints")
	for k, v := range filter {
		if k == "Complain_id" {
			num, err = q.Filter("Id", v).Update(orm.Params{"ReplyStatus": 1})
		}
	}
	return
}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:18,代碼來源:complaint.go

示例14: GetOneComplain

//根據投訴編號獲取投訴信息
func GetOneComplain(filter map[string]interface{}) (*models.JobComplaint, error) {
	var complaint models.JobComplaint
	var err error
	defer func() {
		if err != nil {
			utils.GetLog().Error("services.job.GetOneComplain : error : %s", err.Error())
		} else {
			utils.GetLog().Debug("services.job.GetOneComplain : debug : filter=%s, job=%v", utils.Sdump(filter), utils.Sdump(complaint))
		}
	}()
	q := models.GetDB().QueryTable("job_complaints").RelatedSel("Job", "User", "Project")
	for k, v := range filter {
		q = q.Filter(k, v)
	}
	err = q.One(&complaint)
	if err == orm.ErrNoRows {
		err = errors.New("投訴找不到")
	}
	return &complaint, err

}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:22,代碼來源:complaint.go

示例15: Login

func (u *User) Login(email string, password string) (err error) {
	defer func() {
		if err != nil {
			utils.GetLog().Error("user.User.Login : error :%s", err.Error())
		}
		utils.GetLog().Debug("user.User.Login : user = %s", utils.Sdump(u))
	}()

	u.email = NewEmail(email)
	u.password = NewPassword(password)

	if err = u.validLogin(); err != nil {
		return err
	}

	if err = u.afterLogin(); err != nil {
		return err
	}

	return nil
}
開發者ID:zbzzbd,項目名稱:beego,代碼行數:21,代碼來源:user.go


注:本文中的utils.GetLog函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。