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


Golang Logger.Warning方法代码示例

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


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

示例1: UninstallCommand

// UninstallCommand configures the Uninstall struct and calls it based on the
// given codegangsta/cli context.
//
// TODO: remove all artifacts, ie bolt db, ssh keys, kd etc.
func UninstallCommand(c *cli.Context, log logging.Logger, _ string) (string, int) {
	warnings := []string{}

	// Ensure /etc/kite/kite.key is migrated to konfig.bolt before
	// old klient gets uninstalled. The endpoint/config package
	// performs lazy migrations, so it's enough to call any of
	// its methods and disregard the result.
	_ = configcli.List()

	s, err := newService(nil)
	if err != nil {
		log.Warning("Failed creating Service for uninstall. err:%s", err)
		warnings = append(warnings, FailedUninstallingKlientWarn)
	}

	uninstaller := &Uninstall{
		ServiceUninstaller: s,
		KlientName:         config.KlientName,
		KlientctlName:      config.Name,
		KlientctlPath:      filepath.Join(KlientctlDirectory, KlientctlBinName),
		// TODO: Store the klient directory structure(s) somewhere
		KlientParentDirectory: "/opt",
		KlientDirectory:       "kite/klient",
		KlientFilename:        "klient",
		KlientshFilename:      "klient.sh",
		remover:               os.Remove,
		warnings:              warnings,
		log:                   log,
	}

	return uninstaller.Uninstall()
}
开发者ID:,项目名称:,代码行数:36,代码来源:

示例2: startKlient

func startKlient(log logging.Logger, s service.Service) error {
	// For debug purposes, run a health check before we even attempt to start. This
	// will help give us a sense of what this machine's health check was before
	// klient tried to start.
	if res, ok := defaultHealthChecker.CheckAllExceptRunning(); !ok {
		log.Warning("before attempting to start klient health check returned not-okay. reason: %s", res)
	}

	if err := s.Start(); err != nil {
		log.Error("Error starting Service. err:%s", err)
		fmt.Println(FailedStartKlient)
		return err
	}

	fmt.Println("Starting...")

	err := WaitUntilStarted(config.Konfig.Endpoints.Klient.Private.String(), CommandAttempts, CommandWaitTime)
	if err != nil {
		log.Error(
			"Timed out while waiting for Klient to start. attempts:%d, err:%s",
			CommandAttempts, err,
		)

		if s, ok := defaultHealthChecker.CheckAllExceptRunning(); !ok {
			fmt.Printf(`Failed to start %s in time.

A health check found the following issue:
%s
`, config.KlientName, s)
		} else {
			fmt.Println(FailedStartKlient)
		}

		return err
	}

	return nil
}
开发者ID:,项目名称:,代码行数:38,代码来源:

示例3: restoreLoadedMachineFromKite

// restoreLoadedMachineFromKite takes an old loaded machine and applies meta
// changes to it, while also creating a valid machine instance with a proper
// transport/etc.
func (r *Remote) restoreLoadedMachineFromKite(c *KodingClient, loadedMachine *machine.Machine, log logging.Logger) (bool, error) {
	// metaChanged is our return value, which lets the caller know if any of the meta
	// for this machine changed from the given kite. If it does, the caller will
	// want to save the machines to the local db.
	var metaChanged bool

	host, err := r.hostFromClient(c.Client)
	if err != nil {
		log.Error("Unable to extract host from *kite.Client. err:%s", err)
		return false, err
	}

	// Get our old machine meta, loaded from the DB
	machineMeta := loadedMachine.MachineMeta
	if machineMeta.MachineLabel != c.MachineLabel {
		machineMeta.MachineLabel = c.MachineLabel
		metaChanged = true
	}

	if machineMeta.URL == "" && c.URL != "" {
		log.Warning("Machine missing MachineMeta.URL, updating it to %q", c.URL)
		machineMeta.URL = c.URL
		metaChanged = true
	}

	if machineMeta.IP == "" && host != "" {
		log.Warning("Machine missing MachineMeta.IP, updating it to %q", host)
		machineMeta.IP = host
		metaChanged = true
	}

	if machineMeta.Hostname != c.Hostname {
		machineMeta.Hostname = c.Hostname
		metaChanged = true
	}

	if machineMeta.Username != c.Username {
		machineMeta.Username = c.Username
		metaChanged = true
	}

	// Remove the machine, because we're going to be creating a new machine instance
	// below.
	err = r.machines.Remove(loadedMachine)
	if err != nil && err != machine.ErrMachineNotFound {
		log.Error("Unable to Remove old machine from *machine.Machines. err:%s", err)
		return false, err
	}

	restoredMachine, err := machine.NewMachine(machineMeta, r.log, c.Client)
	if err != nil {
		return false, err
	}

	// Add our newly created machine instance.
	if err = r.machines.Add(restoredMachine); err != nil {
		log.Error("Unable to Add new machine to *machine.Machines. err:%s", err)
		return false, err
	}

	return metaChanged, nil
}
开发者ID:koding,项目名称:koding,代码行数:65,代码来源:remote.go


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