当前位置: 首页>>代码示例>>Golang>>正文


Golang T.Info方法代码示例

本文整理汇总了Golang中github.com/aws/amazon-ssm-agent/agent/log.T.Info方法的典型用法代码示例。如果您正苦于以下问题:Golang T.Info方法的具体用法?Golang T.Info怎么用?Golang T.Info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/aws/amazon-ssm-agent/agent/log.T的用法示例。


在下文中一共展示了T.Info方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: initializeBookkeepingLocations

// initializeBookkeepingLocations - initializes all folder locations required for bookkeeping
func initializeBookkeepingLocations(log logger.T, instanceID string) bool {

	//Create folders pending, current, completed, corrupt under the location DefaultLogDirPath/<instanceId>
	log.Info("Initializing bookkeeping folders")
	initStatus := true
	folders := []string{
		appconfig.DefaultLocationOfPending,
		appconfig.DefaultLocationOfCurrent,
		appconfig.DefaultLocationOfCompleted,
		appconfig.DefaultLocationOfCorrupt}

	for _, folder := range folders {

		directoryName := path.Join(appconfig.DefaultDataStorePath,
			instanceID,
			appconfig.DefaultCommandRootDirName,
			appconfig.DefaultLocationOfState,
			folder)

		err := fileutil.MakeDirs(directoryName)
		if err != nil {
			log.Errorf("Encountered error while creating folders for internal state management. %v", err)
			initStatus = false
			break
		}
	}

	return initStatus
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:30,代码来源:coremanager.go

示例2: processRegistration

// processRegistration handles flags related to the registration category
func processRegistration(log logger.T) (exitCode int) {
	if activationCode == "" || activationID == "" || region == "" {
		// clear registration
		if clear {
			return clearRegistration(log)
		}
		flagUsage()
		return 1
	}

	// check if previously registered
	if !force && registration.InstanceID() != "" {
		confirmation, err := askForConfirmation()
		if err != nil {
			log.Errorf("Registration failed due to %v", err)
			return 1
		}

		if !confirmation {
			log.Info("Registration canceled by user")
			return 1
		}
	}

	managedInstanceID, err := registerManagedInstance()
	if err != nil {
		log.Errorf("Registration failed due to %v", err)
		return 1
	}

	log.Infof("Successfully registered the instance with AWS SSM using Managed instance-id: %s", managedInstanceID)
	return 0
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:34,代码来源:agent_parser.go

示例3: stop

func stop(log logger.T, cpm *coremanager.CoreManager) {
	log.Info("Stopping agent")
	log.Flush()
	cpm.Stop()
	log.Info("Bye.")
	log.Flush()
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:7,代码来源:agent.go

示例4: clearRegistration

// clearRegistration clears any existing registration data
func clearRegistration(log logger.T) (exitCode int) {
	err := registration.UpdateServerInfo("", "", "", "")
	if err == nil {
		log.Info("Registration information has been removed from the instance.")
		return 0
	}
	log.Errorf("error clearing the instance registration information. %v\nTry running as sudo/administrator.", err)
	return 1
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:10,代码来源:agent_parser.go

示例5: blockUntilSignaled

func blockUntilSignaled(log logger.T) {
	// Below channel will handle all machine initiated shutdown/reboot requests.

	// Set up channel on which to receive signal notifications.
	// We must use a buffered channel or risk missing the signal
	// if we're not ready to receive when the signal is sent.
	c := make(chan os.Signal, 1)

	// Listening for OS signals is a blocking call.
	// Only listen to signals that require us to exit.
	// Otherwise we will continue execution and exit the program.
	signal.Notify(c, os.Interrupt, os.Kill, syscall.SIGTERM)

	s := <-c
	log.Info("Got signal:", s, " value:", s.Signal)
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:16,代码来源:agent.go

示例6: processSendReply

func processSendReply(log log.T, messageID string, mdsService service.Service, payloadDoc messageContracts.SendReplyPayload, processorStopPolicy *sdkutil.StopPolicy) {
	payloadB, err := json.Marshal(payloadDoc)
	if err != nil {
		log.Error("could not marshal reply payload!", err)
	}
	payload := string(payloadB)
	log.Info("Sending reply ", jsonutil.Indent(payload))
	err = mdsService.SendReply(log, messageID, payload)
	if err != nil {
		sdkutil.HandleAwsError(log, err, processorStopPolicy)
	}
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:12,代码来源:processor.go

示例7: RebootMachine

// RebootMachine reboots the machine
func RebootMachine(log log.T) {
	log.Info("Executing reboot request...")
	if RebootInitiated() {
		return
	}

	syncObject.Lock()
	defer syncObject.Unlock()
	if err := reboot(log); err != nil {
		log.Error("error in rebooting the machine", err)
		return
	}
	rebootInitiated = true
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:15,代码来源:rebooter.go

示例8: SendReply

// SendReply calls the SendReply MDS API.
func (mds *sdkService) SendReply(log log.T, messageID string, payload string) (err error) {
	uuid.SwitchFormat(uuid.CleanHyphen)
	replyID := uuid.NewV4().String()
	params := &ssmmds.SendReplyInput{
		MessageId: aws.String(messageID), // Required
		Payload:   aws.String(payload),   // Required
		ReplyId:   aws.String(replyID),   // Required
	}
	log.Debug("Calling SendReply with params", params)
	req, resp := mds.sdk.SendReplyRequest(params)
	if err = mds.sendRequest(req); err != nil {
		err = fmt.Errorf("SendReply Error: %v", err)
		log.Debug(err)
	} else {
		log.Info("SendReply Response", resp)
	}
	return
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:19,代码来源:service.go

示例9: AppendInfo

// AppendInfo adds info to UpdateContext StandardOut
func (out *UpdatePluginOutput) AppendInfo(log log.T, format string, params ...interface{}) {
	message := fmt.Sprintf(format, params...)
	log.Info(message)
	out.Stdout = fmt.Sprintf("%v\n%v", out.Stdout, message)
}
开发者ID:aws,项目名称:amazon-ssm-agent,代码行数:6,代码来源:updateagent.go


注:本文中的github.com/aws/amazon-ssm-agent/agent/log.T.Info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。