• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang logger.Info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/getgauge/gauge/logger.Info函数的典型用法代码示例。如果您正苦于以下问题:Golang Info函数的具体用法?Golang Info怎么用?Golang Info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: printExecutionStatus

func printExecutionStatus(suiteResult *result.SuiteResult, errMap *validationErrMaps) int {
	nSkippedScenarios := len(errMap.scenarioErrs)
	nSkippedSpecs := len(errMap.specErrs)
	nExecutedSpecs := len(suiteResult.SpecResults) - nSkippedSpecs
	nFailedSpecs := suiteResult.SpecsFailedCount
	nPassedSpecs := nExecutedSpecs - nFailedSpecs

	nExecutedScenarios := 0
	nFailedScenarios := 0
	nPassedScenarios := 0
	for _, specResult := range suiteResult.SpecResults {
		nExecutedScenarios += specResult.ScenarioCount
		nFailedScenarios += specResult.ScenarioFailedCount
	}
	nExecutedScenarios -= nSkippedScenarios
	nPassedScenarios = nExecutedScenarios - nFailedScenarios

	logger.Info("Specifications:\t%d executed\t%d passed\t%d failed\t%d skipped", nExecutedSpecs, nPassedSpecs, nFailedSpecs, nSkippedSpecs)
	logger.Info("Scenarios:\t%d executed\t%d passed\t%d failed\t%d skipped", nExecutedScenarios, nPassedScenarios, nFailedScenarios, nSkippedScenarios)
	logger.Info("\nTotal time taken: %s", time.Millisecond*time.Duration(suiteResult.ExecutionTime))

	for _, unhandledErr := range suiteResult.UnhandledErrors {
		logger.Error(unhandledErr.Error())
	}
	exitCode := 0
	if suiteResult.IsFailed || (nSkippedSpecs+nSkippedScenarios) > 0 {
		exitCode = 1
	}
	return exitCode
}
开发者ID:andrewmkrug,项目名称:gauge,代码行数:30,代码来源:execute.go


示例2: addPluginToTheProject

func addPluginToTheProject(pluginName string, pluginArgs map[string]string, manifest *manifest.Manifest) error {
	if !plugin.IsPluginInstalled(pluginName, pluginArgs["version"]) {
		logger.Info("Plugin %s %s is not installed. Downloading the plugin.... \n", pluginName, pluginArgs["version"])
		result := InstallPlugin(pluginName, pluginArgs["version"])
		if !result.Success {
			logger.Error(result.getMessage())
		}
	}
	pd, err := plugin.GetPluginDescriptor(pluginName, pluginArgs["version"])
	if err != nil {
		return err
	}
	if plugin.IsPluginAdded(manifest, pd) {
		logger.Info("Plugin " + pd.Name + " is already added.")
		return nil
	}

	action := setupScope
	if err := plugin.SetEnvForPlugin(action, pd, manifest, pluginArgs); err != nil {
		return err
	}
	if _, err := plugin.StartPlugin(pd, action, true); err != nil {
		return err
	}
	manifest.Plugins = append(manifest.Plugins, pd.Id)
	return manifest.Save()
}
开发者ID:jasonchaffee,项目名称:gauge,代码行数:27,代码来源:install.go


示例3: InitializeProject

// InitializeProject initializes a Gauge project with specified template
func InitializeProject(templateName string) {
	wd, err := os.Getwd()
	if err != nil {
		logger.Fatalf("Failed to find working directory. %s", err.Error())
	}
	config.ProjectRoot = wd

	exists, _ := common.UrlExists(getTemplateURL(templateName))

	if exists {
		err = initializeTemplate(templateName)
	} else {
		err = createProjectTemplate(templateName)
	}

	if err != nil {
		logger.Fatalf("Failed to initialize project. %s", err.Error())
	}
	logger.Info("Successfully initialized the project. Run specifications with \"gauge specs/\"\n")

	language := getTemplateLangauge(templateName)
	if !install.IsCompatiblePluginInstalled(language, true) {
		logger.Info("Compatible langauge plugin %s is not installed. Installing plugin...", language)

		install.HandleInstallResult(install.InstallPlugin(language, ""), language, true)
	}
}
开发者ID:mattdotmatt,项目名称:gauge,代码行数:28,代码来源:init.go


示例4: ListTemplates

// ListTemplates lists all the Gauge templates available in GaugeTemplatesURL
func ListTemplates() {
	templatesURL := config.GaugeTemplatesUrl()
	_, err := common.UrlExists(templatesURL)
	if err != nil {
		logger.Fatalf("Gauge templates URL is not reachable: %s", err.Error())
	}
	tempDir := common.GetTempDir()
	defer util.Remove(tempDir)
	templatesPage, err := util.Download(templatesURL, tempDir, "", true)
	if err != nil {
		util.Remove(tempDir)
		logger.Fatalf("Error occurred while downloading templates list: %s", err.Error())
	}

	templatePageContents, err := common.ReadFileContents(templatesPage)
	if err != nil {
		util.Remove(tempDir)
		logger.Fatalf("Failed to read contents of file %s: %s", templatesPage, err.Error())
	}
	templates := getTemplateNames(templatePageContents)
	for _, template := range templates {
		logger.Info(template)
	}
	logger.Info("\nRun `gauge --init <template_name>` to create a new Gauge project.")
}
开发者ID:mattdotmatt,项目名称:gauge,代码行数:26,代码来源:init.go


示例5: GetPluginsInfo

func GetPluginsInfo() []PluginInfo {
	allPluginsWithVersion, err := GetAllInstalledPluginsWithVersion()
	if err != nil {
		logger.Info("No plugins found")
		logger.Info("Plugins can be installed with `gauge --install {plugin-name}`")
		os.Exit(0)
	}
	return allPluginsWithVersion
}
开发者ID:mattdotmatt,项目名称:gauge,代码行数:9,代码来源:plugin.go


示例6: PrintUpdateInfoWithDetails

func PrintUpdateInfoWithDetails() {
	updates := checkUpdates()
	if len(updates) > 0 {
		for _, update := range updates {
			logger.Info(fmt.Sprintf("%-10s\t\t%-10s\t%s", update.Name, update.CompatibleVersion, update.Message))
		}
	} else {
		logger.Info("No Updates available.")
	}
}
开发者ID:jasonchaffee,项目名称:gauge,代码行数:10,代码来源:check.go


示例7: UpdatePlugins

// UpdatePlugins updates all the currently installed plugins to its latest version
func UpdatePlugins() {
	var failedPlugin []string
	for _, pluginInfo := range plugin.GetPluginsInfo() {
		logger.Info("Updating plugin '%s'", pluginInfo.Name)
		passed := HandleUpdateResult(InstallPlugin(pluginInfo.Name, ""), pluginInfo.Name, false)
		if !passed {
			failedPlugin = append(failedPlugin, pluginInfo.Name)
		}
		fmt.Println()
	}
	if len(failedPlugin) > 0 {
		logger.Fatalf("Failed to update '%s' plugins.", strings.Join(failedPlugin, ", "))
	}
	logger.Info("Successfully updated all the plugins.")
}
开发者ID:mattdotmatt,项目名称:gauge,代码行数:16,代码来源:install.go


示例8: InstallPluginZip

func InstallPluginZip(zipFile string, pluginName string) {
	if err := installPluginFromZip(zipFile, pluginName); err != nil {
		logger.Warning("Failed to install plugin. Invalid zip file : %s\n", err)
	} else {
		logger.Info("Successfully installed plugin from file.")
	}
}
开发者ID:jasonchaffee,项目名称:gauge,代码行数:7,代码来源:install.go


示例9: printRefactoringSummary

func printRefactoringSummary(refactoringResult *refactoringResult) {
	exitCode := 0
	if !refactoringResult.Success {
		exitCode = 1
		for _, err := range refactoringResult.Errors {
			logger.Errorf("%s \n", err)
		}
	}
	for _, warning := range refactoringResult.warnings {
		logger.Warning("%s \n", warning)
	}
	logger.Info("%d specifications changed.\n", len(refactoringResult.specsChanged))
	logger.Info("%d concepts changed.\n", len(refactoringResult.conceptsChanged))
	logger.Info("%d files in code changed.\n", len(refactoringResult.runnerFilesChanged))
	os.Exit(exitCode)
}
开发者ID:mattdotmatt,项目名称:gauge,代码行数:16,代码来源:refactor.go


示例10: installPluginsFromManifest

func installPluginsFromManifest(manifest *manifest.Manifest) {
	pluginsMap := make(map[string]bool, 0)
	pluginsMap[manifest.Language] = true
	for _, plugin := range manifest.Plugins {
		pluginsMap[plugin] = false
	}

	for pluginName, isRunner := range pluginsMap {
		if !IsCompatiblePluginInstalled(pluginName, isRunner) {
			logger.Info("Compatible version of plugin %s not found. Installing plugin %s...", pluginName, pluginName)
			HandleInstallResult(InstallPlugin(pluginName, ""), pluginName, true)
		} else {
			logger.Info("Plugin %s is already installed.", pluginName)
		}
	}
}
开发者ID:mattdotmatt,项目名称:gauge,代码行数:16,代码来源:install.go


示例11: installPluginVersion

func installPluginVersion(installDesc *installDescription, versionInstallDescription *versionInstallDescription) installResult {
	if common.IsPluginInstalled(installDesc.Name, versionInstallDescription.Version) {
		return installSuccess(fmt.Sprintf("Plugin %s %s is already installed.", installDesc.Name, versionInstallDescription.Version))
	}

	logger.Info("Installing Plugin => %s %s\n", installDesc.Name, versionInstallDescription.Version)
	downloadLink, err := getDownloadLink(versionInstallDescription.DownloadUrls)
	if err != nil {
		return installError(fmt.Sprintf("Could not get download link: %s", err.Error()))
	}

	tempDir := common.GetTempDir()
	defer common.Remove(tempDir)
	unzippedPluginDir, err := util.DownloadAndUnzip(downloadLink, tempDir)
	if err != nil {
		return installError(err.Error())
	}

	if err := runInstallCommands(versionInstallDescription.Install, unzippedPluginDir); err != nil {
		return installError(fmt.Sprintf("Failed to Run install command. %s.", err.Error()))
	}
	err = copyPluginFilesToGauge(installDesc, versionInstallDescription, unzippedPluginDir)
	if err != nil {
		installError(err.Error())
	}
	return installSuccess("")
}
开发者ID:0-T-0,项目名称:gauge,代码行数:27,代码来源:install.go


示例12: InstallPluginFromZipFile

// InstallPluginFromZipFile installs plugin from given zip file
func InstallPluginFromZipFile(zipFile string, pluginName string) InstallResult {
	tempDir := common.GetTempDir()
	defer common.Remove(tempDir)
	unzippedPluginDir, err := common.UnzipArchive(zipFile, tempDir)
	if err != nil {
		return installError(err)
	}

	gp, err := parsePluginJSON(unzippedPluginDir, pluginName)
	if err != nil {
		return installError(err)
	}

	if err = runPlatformCommands(gp.PreInstall, unzippedPluginDir); err != nil {
		return installError(err)
	}

	pluginInstallDir, err := getPluginInstallDir(gp.ID, getVersionedPluginDirName(zipFile))
	if err != nil {
		return installError(err)
	}

	// copy files to gauge plugin install location
	logger.Info("Installing plugin %s %s", gp.ID, filepath.Base(pluginInstallDir))
	if _, err = common.MirrorDir(unzippedPluginDir, pluginInstallDir); err != nil {
		return installError(err)
	}

	if err = runPlatformCommands(gp.PostInstall, pluginInstallDir); err != nil {
		return installError(err)
	}
	return installSuccess("")
}
开发者ID:mattdotmatt,项目名称:gauge,代码行数:34,代码来源:install.go


示例13: runInstallCommands

func runInstallCommands(installCommands platformSpecificCommand, workingDir string) error {
	command := []string{}
	switch runtime.GOOS {
	case "windows":
		command = installCommands.Windows
		break
	case "darwin":
		command = installCommands.Darwin
		break
	default:
		command = installCommands.Linux
		break
	}

	if len(command) == 0 {
		return nil
	}

	logger.Info("Running plugin install command => %s\n", command)
	cmd, err := common.ExecuteCommand(command, workingDir, os.Stdout, os.Stderr)

	if err != nil {
		return err
	}

	return cmd.Wait()
}
开发者ID:0-T-0,项目名称:gauge,代码行数:27,代码来源:install.go


示例14: InstallPluginZip

func InstallPluginZip(zipFile string, pluginName string) {
	if err := installPluginFromZip(zipFile, pluginName); err != nil {
		logger.Fatal("Failed to install plugin. %s\n", err.Error())
	} else {
		logger.Info("Successfully installed plugin from file.")
	}
}
开发者ID:andrewmkrug,项目名称:gauge,代码行数:7,代码来源:install.go


示例15: InstallPlugin

// InstallPlugin download and install the latest plugin(if version not specified) of given plugin name
func InstallPlugin(pluginName, version string) InstallResult {
	logger.Info("Gathering metadata for %s", pluginName)
	installDescription, result := getInstallDescription(pluginName, false)
	defer util.RemoveTempDir()
	if !result.Success {
		return result
	}
	return installPluginWithDescription(installDescription, version)
}
开发者ID:mattdotmatt,项目名称:gauge,代码行数:10,代码来源:install.go


示例16: Validate

func Validate(args []string) {
	runner := startAPI()
	_, errMap := ValidateSpecs(args, runner)
	runner.Kill()
	if len(errMap.StepErrs) > 0 {
		os.Exit(1)
	}
	logger.Info("No error found.")
}
开发者ID:mattdotmatt,项目名称:gauge,代码行数:9,代码来源:validate.go


示例17: UpdatePlugins

func UpdatePlugins() {
	var failedPlugin []string
	for _, pluginInfo := range plugin.GetPluginsInfo() {
		logger.Info("Updating plugin '%s'", pluginInfo.Name)
		err := downloadAndInstall(pluginInfo.Name, "", fmt.Sprintf("Successfully updated plugin => %s", pluginInfo.Name))
		if err != nil {
			logger.Error(err.Error())
			failedPlugin = append(failedPlugin, pluginInfo.Name)
		}
		fmt.Println()
	}
	if len(failedPlugin) > 0 {
		logger.Error("Failed to update '%s' plugins.", strings.Join(failedPlugin, ", "))
		os.Exit(1)
	}
	logger.Info("Successfully updated all the plugins.")
	os.Exit(0)
}
开发者ID:0-T-0,项目名称:gauge,代码行数:18,代码来源:install.go


示例18: parseSpecs

func parseSpecs(args []string) ([]*gauge.Specification, *gauge.ConceptDictionary) {
	conceptsDictionary, conceptParseResult := parser.CreateConceptsDictionary(false, args)
	parser.HandleParseResult(conceptParseResult)
	specsToExecute, _ := filter.GetSpecsToExecute(conceptsDictionary, args)
	if len(specsToExecute) == 0 {
		logger.Info("No specifications found in %s.", strings.Join(args, ", "))
		os.Exit(0)
	}
	return specsToExecute, conceptsDictionary
}
开发者ID:mattdotmatt,项目名称:gauge,代码行数:10,代码来源:validate.go


示例19: filter

func (groupFilter *specsGroupFilter) filter(specs []*parser.Specification) []*parser.Specification {
	if groupFilter.group == -1 {
		return specs
	}
	logger.Info("Using the -g flag will make the distribution strategy 'eager'. The --strategy setting will be overridden.")
	if groupFilter.group < 1 || groupFilter.group > groupFilter.execStreams {
		return make([]*parser.Specification, 0)
	}
	return DistributeSpecs(sortSpecsList(specs), groupFilter.execStreams)[groupFilter.group-1].Specs
}
开发者ID:jasonchaffee,项目名称:gauge,代码行数:10,代码来源:specsFilter.go


示例20: UninstallPlugin

func UninstallPlugin(pluginName string, version string) {
	pluginsDir, err := common.GetPrimaryPluginsInstallDir()
	if err != nil {
		handleUninstallFailure(err, pluginName)
	}
	pluginInfo := pluginName
	if version != "" {
		pluginInfo = fmt.Sprintf("%s(%s)", pluginName, version)
	}
	pluginInstallationDir := path.Join(pluginsDir, pluginName, version)
	if common.DirExists(pluginInstallationDir) {
		if err = os.RemoveAll(pluginInstallationDir); err != nil {
			handleUninstallFailure(err, pluginInfo)
		} else {
			logger.Info("%s plugin uninstalled successfully", pluginInfo)
		}
	} else {
		logger.Info("%s plugin is not installed", pluginInfo)
	}
}
开发者ID:0-T-0,项目名称:gauge,代码行数:20,代码来源:install.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang logger.Warning函数代码示例发布时间:2022-05-23
下一篇:
Golang logger.Fatalf函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap