當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Logger.NewErr方法代碼示例

本文整理匯總了Golang中github.com/sqp/godock/libs/cdtype.Logger.NewErr方法的典型用法代碼示例。如果您正苦於以下問題:Golang Logger.NewErr方法的具體用法?Golang Logger.NewErr怎麽用?Golang Logger.NewErr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/sqp/godock/libs/cdtype.Logger的用法示例。


在下文中一共展示了Logger.NewErr方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: InfoApplet

// InfoApplet asks the dock all informations about an applet.
//
func InfoApplet(log cdtype.Logger, name string) *packages.AppletPackage {
	vars, _ := DockProperties("type=Module & name=" + name)
	if len(vars) == 0 {
		log.NewErr("unknown applet", "InfoApplet", name)
		return nil
	}
	pack, _ := parseApplet(log, vars[0])
	return pack
}
開發者ID:sqp,項目名稱:godock,代碼行數:11,代碼來源:dockbus.go

示例2: ListFieldsIDByName

// ListFieldsIDByName searches the list of fields for the matching key.
// Returns the position of the field in the list.
// Returns 0 if not found, to have a valid entry to select.
//
func ListFieldsIDByName(fields []Field, key string, log cdtype.Logger) int {
	for i, field := range fields {
		if key == field.Key {
			return i
		}
	}
	if log != nil {
		log.NewErr("not found", "ListFieldsIDByName", key, fields)
	}
	return 0
}
開發者ID:sqp,項目名稱:godock,代碼行數:15,代碼來源:datatype.go

示例3: NewBuilder

// NewBuilder creates the target renderer/builder.
// The name is mandatory for a single applet (internal or not).
//
func NewBuilder(target SourceType, name string, log cdtype.Logger) Builder {
	switch target {

	case TypeGodock:
		build := &BuilderGodock{}
		build.SetLogger(log)
		return build

	case TypeCore:
		build := &BuilderCore{}
		build.SetLogger(log)
		return build

	case TypeApplets:
		build := &BuilderApplets{}
		build.SetLogger(log)
		return build

	case TypeAppletCompiled:
		dir, icon := AppletInfo(log, name)
		if dir == "" {
			log.NewErr("applet not found: "+name, "new builder")
			return &BuilderNull{}
		}

		build := &BuilderCompiled{Module: name}
		build.SetLogger(log)
		build.SetIcon(icon)
		build.SetDir(dir)
		return build

	case TypeAppletInternal:
		// Ask icon of module to the Dock as we can't guess its dir and icon name.
		_, icon := AppletInfo(log, strings.Replace(name, "-", " ", -1))
		if icon == "" {
			icon = IconMissing
		}

		build := &BuilderInternal{Module: name}
		build.SetLogger(log)
		build.SetIcon(icon)
		return build
	}

	// ensure we have a valid target.
	return &BuilderNull{}
}
開發者ID:sqp,項目名稱:godock,代碼行數:50,代碼來源:build.go


注:本文中的github.com/sqp/godock/libs/cdtype.Logger.NewErr方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。