本文整理匯總了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
}
示例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
}
示例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{}
}