Help us shape the future of Go! Take the 2026 Go Developer Survey

joblog

package module
v0.0.0-...-ea69004 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2020 License: Apache-2.0 Imports: 6 Imported by: 1

README

joblog

log print for eland job monitor

Getting Started

//new with serviceName
jobLog := joblog.New(url, "test", map[string]interface{}{"log": "this is test"})
//new with serviceName&jobName&actionName
jobLog = joblog.New(url, "test", map[string]interface{}{"log": "this is test 2"}, func(log *joblog.JobLog) {
			log.JobName = "JobName"
			log.ActionName = "ActionName"
		})

err := jobLog.Info("good")
test.Ok(t, err)

err = jobLog.Warning(struct{ Name string }{"xiaoxinmiao"})
test.Ok(t, err)

err = jobLog.Error(errors.New("this is bug."))
test.Ok(t, err)
joblog.New

Create job log

  • url - Save data to job monitor via this url,like:https://xxx.com.cn/batchjob-api/v1/jobs
  • serviceName - The name of the microservice to store the log, usually the project name, for example: ibill-qa
  • firstMessage - Print the contents of the first log,it can only pass struct, pointer struct or maps.
  • options - Optional parameters can be modified,for example:disable=false
Info Warning Error

Print info/warning/error log

  • message - Print the contents of log,It can pass any type of parameter.

View log

https://wiki.elandsystems.cn/display/DBA/Batch-job+Monitor

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JobLog

type JobLog struct {
	JobName    string
	ActionName string

	Disable bool
	Err     error
	// contains filtered or unexported fields
}

func New

func New(url, serviceName string, firstMessage interface{}, options ...func(*JobLog)) (jobLog *JobLog)

func (*JobLog) Error

func (r *JobLog) Error(message interface{}) error

func (*JobLog) Finish

func (r *JobLog) Finish() (err error)

func (*JobLog) Info

func (r *JobLog) Info(message interface{}) error

func (*JobLog) Warning

func (r *JobLog) Warning(message interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL