func arbitraryfunc(component *logberry.Task) error { // Start a long-running task, using Begin() to log start & begin timer task := component.Task("Arbitrary computation") // Report some intermediate progress task.Info("Intermediate progress", logberry.D{"Best": 9}) // An error has occurred out of nowhere! Log & return an error // noting that this task has failed, data associated with the error, // wrapping the underlying cause, and noting this source location return task.Failure("Random unrecoverable error", logberry.D{"Bounds": "x-axis"}) }
func somework(parent *logberry.Task) error { task := parent.Task("Some work") e := errors.New("inscrutable library error") return task.WrapError("Mix-up in job order", e) }