本文整理汇总了Golang中github.com/pivotal-golang/lager.Logger.Debug方法的典型用法代码示例。如果您正苦于以下问题:Golang Logger.Debug方法的具体用法?Golang Logger.Debug怎么用?Golang Logger.Debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pivotal-golang/lager.Logger
的用法示例。
在下文中一共展示了Logger.Debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: heartbeatContinuously
func (v *volume) heartbeatContinuously(logger lager.Logger, pacemaker clock.Ticker, initialTTL time.Duration) {
defer v.heartbeating.Done()
defer pacemaker.Stop()
logger.Debug("start")
defer logger.Debug("done")
ttlToSet := initialTTL
for {
select {
case <-pacemaker.C():
ttl, found, err := v.db.GetVolumeTTL(v.Handle())
if err != nil {
logger.Error("failed-to-lookup-ttl", err)
} else {
if !found {
logger.Info("volume-expired-from-database")
return
}
ttlToSet = ttl
}
v.heartbeat(logger.Session("tick"), ttlToSet)
case finalTTL := <-v.release:
if finalTTL != nil {
v.heartbeat(logger.Session("final"), *finalTTL)
}
return
}
}
}
示例2: initialDestroy
func (c *checker) initialDestroy(logger lager.Logger, containers []garden.Container) error {
logger = logger.Session("initial-destroy")
logger.Debug("starting", lager.Data{"numContainers": len(containers)})
defer logger.Debug("finished")
for i := range containers {
err := retryOnFail(c.retryInterval, func(attempt uint) (destroyErr error) {
handle := containers[i].Handle()
destroyErr = c.gardenClient.Destroy(handle)
if destroyErr != nil {
if destroyErr.Error() == server.ErrConcurrentDestroy.Error() {
// Log but don't fail if container is already being destroyed
logger.Debug("already-being-destroyed", lager.Data{"handle": handle})
return nil
}
logger.Error("failed", destroyErr, lager.Data{"handle": handle, "attempt": attempt})
return destroyErr
}
logger.Debug("succeeded", lager.Data{"handle": handle, "attempt": attempt})
return nil
})
if err != nil {
return err
}
}
logger.Debug("succeeded")
return nil
}
示例3: emit
func emit(logger lager.Logger, event goryman.Event) {
logger.Debug("emit")
if riemannClient == nil {
return
}
event.Host = eventHost
event.Time = time.Now().Unix()
event.Tags = append(event.Tags, eventTags...)
mergedAttributes := map[string]string{}
for k, v := range eventAttributes {
mergedAttributes[k] = v
}
if event.Attributes != nil {
for k, v := range event.Attributes {
mergedAttributes[k] = v
}
}
event.Attributes = mergedAttributes
select {
case emissions <- eventEmission{logger: logger, event: event}:
default:
logger.Error("queue-full", nil)
}
}
示例4: AppCrashed
func (cc *ccClient) AppCrashed(guid string, appCrashed cc_messages.AppCrashedRequest, logger lager.Logger) error {
logger = logger.Session("cc-client")
logger.Debug("delivering-app-crashed-response", lager.Data{"app_crashed": appCrashed})
payload, err := json.Marshal(appCrashed)
if err != nil {
return err
}
request, err := http.NewRequest("POST", fmt.Sprintf(cc.ccURI, guid), bytes.NewReader(payload))
if err != nil {
return err
}
request.SetBasicAuth(cc.username, cc.password)
request.Header.Set("content-type", "application/json")
response, err := cc.httpClient.Do(request)
if err != nil {
logger.Error("deliver-app-crashed-response-failed", err)
return err
}
defer response.Body.Close()
if response.StatusCode != http.StatusOK {
return &BadResponseError{response.StatusCode}
}
logger.Debug("delivered-app-crashed-response")
return nil
}
示例5: SetEncryptionKeyLabel
func (db *ETCDDB) SetEncryptionKeyLabel(logger lager.Logger, keyLabel string) error {
logger.Debug("set-encryption-key-label", lager.Data{"encryption-key-label": keyLabel})
defer logger.Debug("set-encryption-key-label-finished")
_, err := db.client.Set(EncryptionKeyLabelKey, []byte(keyLabel), NO_TTL)
return err
}
示例6: Initialize
func (a *AllocationStore) Initialize(logger lager.Logger, req *executor.RunRequest) error {
a.lock.Lock()
defer a.lock.Unlock()
container, err := a.lookup(req.Guid)
if err != nil {
logger.Error("failed-initializing-container", err)
return err
}
logger.Debug("initializing-container", lager.Data{"guid": req.Guid})
if container.State != executor.StateReserved {
logger.Error(
"failed-initializing-container",
executor.ErrInvalidTransition,
lager.Data{
"current_state": container.State,
"expected_state": executor.StateReserved,
},
)
return executor.ErrInvalidTransition
}
container.State = executor.StateInitializing
container.RunInfo = req.RunInfo
container.Tags.Add(req.Tags)
a.allocated[container.Guid] = container
return nil
}
示例7: resolveRestartableCrashedActualLRPS
func (db *ETCDDB) resolveRestartableCrashedActualLRPS(logger lager.Logger, actualLRP *models.ActualLRP, starts *startRequests) func() {
return func() {
actualKey := actualLRP.ActualLRPKey
logger = logger.Session("restart-crash", lager.Data{
"process_guid": actualKey.ProcessGuid,
"index": actualKey.Index,
})
if actualLRP.State != models.ActualLRPStateCrashed {
logger.Error("failed-actual-lrp-state-is-not-crashed", nil)
return
}
logger.Debug("unclaiming-actual-lrp", lager.Data{"process_guid": actualLRP.ActualLRPKey.ProcessGuid, "index": actualLRP.ActualLRPKey.Index})
_, err := db.unclaimActualLRP(logger, &actualLRP.ActualLRPKey, &actualLRP.ActualLRPInstanceKey)
if err != nil {
logger.Error("failed-unclaiming-crash", err)
return
}
logger.Debug("succeeded-unclaiming-actual-lrp")
starts.Add(logger, &actualKey)
}
}
示例8: ConvergeLRPs
func (db *ETCDDB) ConvergeLRPs(logger lager.Logger, cellSet models.CellSet) ([]*auctioneer.LRPStartRequest, []*models.ActualLRPKeyWithSchedulingInfo, []*models.ActualLRPKey) {
convergeStart := db.clock.Now()
convergeLRPRunsCounter.Increment()
logger = logger.Session("etcd")
logger.Info("starting-convergence")
defer logger.Info("finished-convergence")
defer func() {
err := convergeLRPDuration.Send(time.Since(convergeStart))
if err != nil {
logger.Error("failed-sending-converge-lrp-duration-metric", err)
}
}()
logger.Debug("gathering-convergence-input")
input, err := db.GatherAndPruneLRPs(logger, cellSet)
if err != nil {
logger.Error("failed-gathering-convergence-input", err)
return nil, nil, nil
}
logger.Debug("succeeded-gathering-convergence-input")
changes := CalculateConvergence(logger, db.clock, models.NewDefaultRestartCalculator(), input)
return db.ResolveConvergence(logger, input.DesiredLRPs, changes)
}
示例9: Tasks
func (db *ETCDDB) Tasks(logger lager.Logger, taskFilter db.TaskFilter) (*models.Tasks, *models.Error) {
root, bbsErr := db.fetchRecursiveRaw(logger, TaskSchemaRoot)
if bbsErr.Equal(models.ErrResourceNotFound) {
return &models.Tasks{}, nil
}
if bbsErr != nil {
return nil, bbsErr
}
if root.Nodes.Len() == 0 {
return &models.Tasks{}, nil
}
tasks := models.Tasks{}
for _, node := range root.Nodes {
node := node
var task models.Task
deserializeErr := models.FromJSON([]byte(node.Value), &task)
if deserializeErr != nil {
logger.Error("failed-parsing-task", deserializeErr, lager.Data{"key": node.Key})
return nil, models.ErrUnknownError
}
if taskFilter == nil || taskFilter(&task) {
tasks.Tasks = append(tasks.Tasks, &task)
}
}
logger.Debug("succeeded-performing-deserialization", lager.Data{"num-tasks": len(tasks.GetTasks())})
return &tasks, nil
}
示例10: applyCachedEvents
func (u *updater) applyCachedEvents(logger lager.Logger) {
logger.Debug("applying-cached-events")
defer logger.Debug("applied-cached-events")
for _, e := range u.cachedEvents {
u.handleEvent(e)
}
}
示例11: Domains
func (db *SQLDB) Domains(logger lager.Logger) ([]string, error) {
logger = logger.Session("domains-sqldb")
logger.Debug("starting")
defer logger.Debug("complete")
expireTime := db.clock.Now().Round(time.Second).UnixNano()
rows, err := db.all(logger, db.db, domainsTable,
domainColumns, NoLockRow,
"expire_time > ?", expireTime,
)
if err != nil {
logger.Error("failed-query", err)
return nil, db.convertSQLError(err)
}
defer rows.Close()
var domain string
var results []string
for rows.Next() {
err = rows.Scan(&domain)
if err != nil {
logger.Error("failed-scan-row", err)
return nil, db.convertSQLError(err)
}
results = append(results, domain)
}
if rows.Err() != nil {
logger.Error("failed-fetching-row", err)
return nil, db.convertSQLError(err)
}
return results, nil
}
示例12: setupRootfs
func (p *LinuxResourcePool) setupRootfs(spec garden.ContainerSpec, id string, resources *linux_backend.Resources, pLog lager.Logger) (string, process.Env, error) {
rootFSURL, err := url.Parse(spec.RootFSPath)
if err != nil {
pLog.Error("parse-rootfs-path-failed", err, lager.Data{
"RootFSPath": spec.RootFSPath,
})
return "", nil, err
}
rootFSSpec := rootfs_provider.Spec{
RootFS: rootFSURL,
Namespaced: resources.RootUID != 0,
QuotaSize: int64(spec.Limits.Disk.ByteHard),
QuotaScope: rootfs_provider.QuotaScope(spec.Limits.Disk.Scope),
}
pLog.Debug("provide-rootfs-starting")
rootFSPath, rootFSEnvVars, err := p.rootFSProvider.Create(pLog, id, rootFSSpec)
if err != nil {
pLog.Error("provide-rootfs-failed", err)
return "", nil, err
}
pLog.Debug("provide-rootfs-ended")
rootFSProcessEnv, err := process.NewEnv(rootFSEnvVars)
if err != nil {
pLog.Error("rootfs-env-malformed", err)
return "", nil, err
}
return rootFSPath, rootFSProcessEnv, nil
}
示例13: createDesiredApp
func (h *DesireAppHandler) createDesiredApp(
logger lager.Logger,
desireAppMessage cc_messages.DesireAppRequestFromCC,
) error {
var builder recipebuilder.RecipeBuilder = h.recipeBuilders["buildpack"]
if desireAppMessage.DockerImageUrl != "" {
builder = h.recipeBuilders["docker"]
}
desiredLRP, err := builder.Build(&desireAppMessage)
if err != nil {
logger.Error("failed-to-build-recipe", err)
return err
}
logger.Debug("creating-desired-lrp", lager.Data{"routes": sanitizeRoutes(desiredLRP.Routes)})
err = h.bbsClient.DesireLRP(desiredLRP)
if err != nil {
logger.Error("failed-to-create-lrp", err)
return err
}
logger.Debug("created-desired-lrp")
return nil
}
示例14: UnclaimActualLRP
func (db *ETCDDB) UnclaimActualLRP(logger lager.Logger, key *models.ActualLRPKey) (*models.ActualLRPGroup, *models.ActualLRPGroup, error) {
actualLRP, modifiedIndex, err := db.rawActualLRPByProcessGuidAndIndex(logger, key.ProcessGuid, key.Index)
bbsErr := models.ConvertError(err)
if bbsErr != nil {
return nil, nil, bbsErr
}
beforeActualLRP := *actualLRP
if actualLRP.State == models.ActualLRPStateUnclaimed {
logger.Debug("already-unclaimed")
return nil, nil, models.ErrActualLRPCannotBeUnclaimed
}
actualLRP.State = models.ActualLRPStateUnclaimed
actualLRP.ActualLRPKey = *key
actualLRP.ActualLRPInstanceKey = models.ActualLRPInstanceKey{}
actualLRP.ActualLRPNetInfo = models.EmptyActualLRPNetInfo()
actualLRP.Since = db.clock.Now().UnixNano()
actualLRP.ModificationTag.Increment()
data, err := db.serializeModel(logger, actualLRP)
if err != nil {
return nil, nil, err
}
_, err = db.client.CompareAndSwap(ActualLRPSchemaPath(key.ProcessGuid, key.Index), data, 0, modifiedIndex)
if err != nil {
logger.Error("failed-compare-and-swap", err)
return nil, nil, ErrorFromEtcdError(logger, err)
}
return &models.ActualLRPGroup{Instance: &beforeActualLRP}, &models.ActualLRPGroup{Instance: actualLRP}, nil
}
示例15: emitMessages
func (watcher *Watcher) emitMessages(logger lager.Logger, messagesToEmit routing_table.MessagesToEmit) {
if watcher.emitter != nil {
logger.Debug("emitting-messages", lager.Data{"messages": messagesToEmit})
watcher.emitter.Emit(messagesToEmit)
routesRegistered.Add(messagesToEmit.RouteRegistrationCount())
routesUnregistered.Add(messagesToEmit.RouteUnregistrationCount())
}
}