本文整理匯總了Golang中github.com/getgauge/gauge/logger.Warning函數的典型用法代碼示例。如果您正苦於以下問題:Golang Warning函數的具體用法?Golang Warning怎麽用?Golang Warning使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Warning函數的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: kill
func (p *plugin) kill(wg *sync.WaitGroup) error {
defer wg.Done()
if p.IsProcessRunning() {
defer p.connection.Close()
conn.SendProcessKillMessage(p.connection)
exited := make(chan bool, 1)
go func() {
for {
if p.IsProcessRunning() {
time.Sleep(100 * time.Millisecond)
} else {
exited <- true
return
}
}
}()
select {
case done := <-exited:
if done {
logger.Debug("Plugin [%s] with pid [%d] has exited", p.descriptor.Name, p.pluginCmd.Process.Pid)
}
case <-time.After(config.PluginConnectionTimeout()):
logger.Warning("Plugin [%s] with pid [%d] did not exit after %.2f seconds. Forcefully killing it.", p.descriptor.Name, p.pluginCmd.Process.Pid, config.PluginConnectionTimeout().Seconds())
err := p.pluginCmd.Process.Kill()
if err != nil {
logger.Warning("Error while killing plugin %s : %s ", p.descriptor.Name, err.Error())
}
return err
}
}
return nil
}
示例2: Kill
func (testRunner *TestRunner) Kill() error {
if testRunner.IsProcessRunning() {
defer testRunner.Connection.Close()
conn.SendProcessKillMessage(testRunner.Connection)
exited := make(chan bool, 1)
go func() {
for {
if testRunner.IsProcessRunning() {
time.Sleep(100 * time.Millisecond)
} else {
exited <- true
return
}
}
}()
select {
case done := <-exited:
if done {
return nil
}
case <-time.After(config.PluginKillTimeout()):
logger.Warning("Killing runner with PID:%d forcefully", testRunner.Cmd.Process.Pid)
return testRunner.killRunner()
}
}
return nil
}
示例3: 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.")
}
}
示例4: kill
func (plugin *plugin) kill(wg *sync.WaitGroup) error {
defer wg.Done()
if plugin.isStillRunning() {
exited := make(chan bool, 1)
go func() {
for {
if plugin.isStillRunning() {
time.Sleep(100 * time.Millisecond)
} else {
exited <- true
return
}
}
}()
select {
case done := <-exited:
if done {
logger.Debug("Plugin [%s] with pid [%d] has exited", plugin.descriptor.Name, plugin.pluginCmd.Process.Pid)
}
case <-time.After(config.PluginConnectionTimeout()):
logger.Warning("Plugin [%s] with pid [%d] did not exit after %.2f seconds. Forcefully killing it.", plugin.descriptor.Name, plugin.pluginCmd.Process.Pid, config.PluginConnectionTimeout().Seconds())
return plugin.pluginCmd.Process.Kill()
}
}
return nil
}
示例5: downloadAndInstall
func downloadAndInstall(plugin, version string, successMessage string) error {
result := InstallPlugin(plugin, version)
if !result.Success {
return fmt.Errorf("%s : %s\n", plugin, result.getMessage())
}
if result.Warning != "" {
logger.Warning(result.Warning)
return nil
}
logger.Info(successMessage)
return nil
}
示例6: AddConcepts
func AddConcepts(conceptFile string, conceptDictionary *ConceptDictionary) *ParseError {
concepts, parseResults := new(ConceptParser).ParseFile(conceptFile)
if parseResults != nil && parseResults.Warnings != nil {
for _, warning := range parseResults.Warnings {
logger.Warning(warning.String())
}
}
if parseResults != nil && parseResults.Error != nil {
return parseResults.Error
}
return conceptDictionary.Add(concepts, conceptFile)
}
示例7: 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)
}
示例8: HandleParseResult
func HandleParseResult(results ...*ParseResult) {
var failed = false
for _, result := range results {
if !result.Ok {
logger.Error(result.Error())
failed = true
}
if result.Warnings != nil {
for _, warning := range result.Warnings {
logger.Warning("%s : %v", result.FileName, warning)
}
}
}
if failed {
os.Exit(1)
}
}
示例9: HandleUpdateResult
// HandleUpdateResult handles the result of plugin Installation
func HandleUpdateResult(result InstallResult, pluginName string, exitIfFailure bool) bool {
if result.Warning != "" {
logger.Warning(result.Warning)
}
if result.Skipped {
return true
}
if !result.Success {
logger.Errorf("Failed to update plugin '%s'.\nReason: %s", pluginName, result.getMessage())
if exitIfFailure {
os.Exit(1)
}
return false
}
logger.Info("Successfully updated plugin '%s'.", pluginName)
return true
}
示例10: AddConcepts
func AddConcepts(conceptFile string, conceptDictionary *gauge.ConceptDictionary) *ParseError {
concepts, parseResults := new(ConceptParser).ParseFile(conceptFile)
if parseResults != nil && parseResults.Warnings != nil {
for _, warning := range parseResults.Warnings {
logger.Warning(warning.String())
}
}
if parseResults != nil && parseResults.Error != nil {
return parseResults.Error
}
for _, conceptStep := range concepts {
if _, exists := conceptDictionary.ConceptsMap[conceptStep.Value]; exists {
return &ParseError{Message: "Duplicate concept definition found", LineNo: conceptStep.LineNo, LineText: conceptStep.LineText}
}
conceptDictionary.ReplaceNestedConceptSteps(conceptStep)
conceptDictionary.ConceptsMap[conceptStep.Value] = &gauge.Concept{conceptStep, conceptFile}
}
conceptDictionary.UpdateLookupForNestedConcepts()
return validateConcepts(conceptDictionary)
}
示例11: Remove
// Remove removes all the files and directories recursively for the given path
func Remove(dir string) {
err := common.Remove(dir)
if err != nil {
logger.Warning("Failed to remove directory %s. Remove it manually. %s", dir, err.Error())
}
}