本文整理汇总了Golang中github.com/aws/amazon-ssm-agent/agent/log.T.Tracef方法的典型用法代码示例。如果您正苦于以下问题:Golang T.Tracef方法的具体用法?Golang T.Tracef怎么用?Golang T.Tracef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/aws/amazon-ssm-agent/agent/log.T
的用法示例。
在下文中一共展示了T.Tracef方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: setCmdState
// setCmdState persists given commandState
func setCmdState(log log.T, commandState message.CommandState, absoluteFileName, locationFolder string) {
content, err := jsonutil.Marshal(commandState)
if err != nil {
log.Errorf("encountered error with message %v while marshalling %v to string", err, commandState)
} else {
if fileutil.Exists(absoluteFileName) {
log.Debugf("overwriting contents of %v", absoluteFileName)
}
log.Tracef("persisting interim state %v in file %v", jsonutil.Indent(content), absoluteFileName)
if s, err := fileutil.WriteIntoFileWithPermissions(absoluteFileName, jsonutil.Indent(content), os.FileMode(int(appconfig.ReadWriteAccess))); s && err == nil {
log.Debugf("successfully persisted interim state in %v", locationFolder)
} else {
log.Debugf("persisting interim state in %v failed with error %v", locationFolder, err)
}
}
}
示例2: getCmdState
// getCmdState reads commandState from given file
func getCmdState(log log.T, fileName string) message.CommandState {
var commandState message.CommandState
err := jsonutil.UnmarshalFile(fileName, &commandState)
if err != nil {
log.Errorf("encountered error with message %v while reading Interim state of command from file - %v", err, fileName)
} else {
//logging interim state as read from the file
jsonString, err := jsonutil.Marshal(commandState)
if err != nil {
log.Errorf("encountered error with message %v while marshalling %v to string", err, commandState)
} else {
log.Tracef("interim CommandState read from file-system - %v", jsonutil.Indent(jsonString))
}
}
return commandState
}
示例3: PersistData
// PersistData stores the given object in the file-system in pretty Json indented format
// This will override the contents of an already existing file
func PersistData(log log.T, commandID, instanceID, locationFolder string, object interface{}) {
lockDocument(commandID)
defer unlockDocument(commandID)
absoluteFileName := getCmdStateFileName(commandID, instanceID, locationFolder)
content, err := jsonutil.Marshal(object)
if err != nil {
log.Errorf("encountered error with message %v while marshalling %v to string", err, object)
} else {
if fileutil.Exists(absoluteFileName) {
log.Debugf("overwriting contents of %v", absoluteFileName)
}
log.Tracef("persisting interim state %v in file %v", jsonutil.Indent(content), absoluteFileName)
if s, err := fileutil.WriteIntoFileWithPermissions(absoluteFileName, jsonutil.Indent(content), os.FileMode(int(appconfig.ReadWriteAccess))); s && err == nil {
log.Debugf("successfully persisted interim state in %v", locationFolder)
} else {
log.Debugf("persisting interim state in %v failed with error %v", locationFolder, err)
}
}
}