Browse Source

优化日志

gitlink
Sydonian 1 year ago
parent
commit
b0168b2b9f
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      agent/internal/task/storage_load_package.go

+ 6
- 3
agent/internal/task/storage_load_package.go View File

@@ -47,13 +47,16 @@ func NewStorageLoadPackage(userID cdssdk.UserID, packageID cdssdk.PackageID, sto
func (t *StorageLoadPackage) Execute(task *task.Task[TaskContext], ctx TaskContext, complete CompleteFn) {
startTime := time.Now()
log := logger.WithType[StorageLoadPackage]("Task")
log.Infof("begin to load package %v to %v", t.packageID, t.storageID)
log.WithField("TaskID", task.ID()).
Infof("begin to load package %v to %v", t.packageID, t.storageID)

err := t.do(task, ctx)
if err == nil {
log.Infof("loading success, cost: %v", time.Since(startTime))
log.WithField("TaskID", task.ID()).
Infof("loading success, cost: %v", time.Since(startTime))
} else {
log.Warnf("loading package: %v, cost: %v", err, time.Since(startTime))
log.WithField("TaskID", task.ID()).
Warnf("loading package: %v, cost: %v", err, time.Since(startTime))
}

complete(err, CompleteOption{


Loading…
Cancel
Save