本文整理汇总了Golang中github.com/keybase/client/go/logger.Logger.Debug方法的典型用法代码示例。如果您正苦于以下问题:Golang Logger.Debug方法的具体用法?Golang Logger.Debug怎么用?Golang Logger.Debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/keybase/client/go/logger.Logger
的用法示例。
在下文中一共展示了Logger.Debug方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewUpdater
func NewUpdater(options keybase1.UpdateOptions, source sources.UpdateSource, config Config, log logger.Logger) *Updater {
log.Debug("New updater with options: %#v", options)
return &Updater{
options: options,
source: source,
config: config,
log: log,
}
}
示例2: WaitForServiceInfoFile
// WaitForServiceInfoFile tries to wait for a service info file, which should be
// written on successful service startup.
func WaitForServiceInfoFile(path string, label string, pid string, maxAttempts int, wait time.Duration, reason string, log logger.Logger) (*ServiceInfo, error) {
if pid == "" {
return nil, fmt.Errorf("No pid to wait for")
}
lookForServiceInfo := func() (*ServiceInfo, error) {
if _, ferr := os.Stat(path); os.IsNotExist(ferr) {
return nil, nil
}
dat, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
var serviceInfo ServiceInfo
err = json.Unmarshal(dat, &serviceInfo)
if err != nil {
return nil, err
}
// Make sure the info file is the pid we are waiting for, otherwise it is
// still starting up.
if pid != fmt.Sprintf("%d", serviceInfo.Pid) {
return nil, nil
}
// PIDs match, the service has started up
return &serviceInfo, nil
}
attempt := 1
serviceInfo, lookErr := lookForServiceInfo()
for attempt < maxAttempts && serviceInfo == nil {
attempt++
log.Debug("Waiting for service info file...")
time.Sleep(wait)
serviceInfo, lookErr = lookForServiceInfo()
}
// If no service info was found, let's return an error
if serviceInfo == nil {
if lookErr == nil {
lookErr = fmt.Errorf("%s isn't running (expecting pid=%s)", label, pid)
}
return nil, lookErr
}
// We succeeded in finding service info
log.Debug("Found service info: %#v", *serviceInfo)
return serviceInfo, nil
}
示例3: makeBlockServer
func makeBlockServer(config Config, serverInMemory bool, serverRootDir, bserverAddr string, log logger.Logger) (
BlockServer, error) {
if serverInMemory {
// local in-memory block server
return NewBlockServerMemory(config)
}
if len(serverRootDir) > 0 {
// local persistent block server
blockPath := filepath.Join(serverRootDir, "kbfs_block")
return NewBlockServerLocal(config, blockPath)
}
if len(bserverAddr) == 0 {
return nil, errors.New("Empty block server address")
}
log.Debug("Using remote bserver %s", bserverAddr)
return NewBlockServerRemote(config, bserverAddr), nil
}
示例4: FindPinentry
func FindPinentry(log logger.Logger) (string, error) {
if !HasWindows() {
return "", fmt.Errorf("Can't spawn gui window, not using pinentry")
}
bins := []string{
// If you install MacTools you'll wind up with this pinentry
"/usr/local/MacGPG2/libexec/pinentry-mac.app/Contents/MacOS/pinentry-mac",
}
extraPaths := []string{}
log.Debug("+ FindPinentry()")
cmds := []string{
"pinentry-gtk-2",
"pinentry-qt4",
"pinentry",
}
checkFull := func(s string) bool {
log.Debug("| Check fullpath %s", s)
found := (canExec(s) == nil)
if found {
log.Debug("- Found: %s", s)
}
return found
}
for _, b := range bins {
if checkFull(b) {
return b, nil
}
}
path := os.Getenv("PATH")
for _, c := range cmds {
log.Debug("| Looking for %s in standard PATH %s", c, path)
fullc, err := exec.LookPath(c)
if err == nil {
log.Debug("- Found %s", fullc)
return fullc, nil
}
}
for _, ep := range extraPaths {
for _, c := range cmds {
full := filepath.Join(ep, c)
if checkFull(full) {
return full, nil
}
}
}
log.Debug("- FindPinentry: none found")
return "", fmt.Errorf("No pinentry found, checked a bunch of different places")
}
示例5: FindPinentry
func FindPinentry(log logger.Logger) (string, error) {
// // If you install GPG you'll wind up with this pinentry
// C:\Program Files (x86)\GNU\GnuPG\pinentry-gtk-2.exe
// C:\Program Files (x86)\GNU\GnuPG\pinentry-qt4.exe
// C:\Program Files (x86)\GNU\GnuPG\pinentry-w32.exe
// C:\Program Files (x86)\GNU\GnuPG\pinentry.exe
k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Wow6432Node\GNU\GnuPG`, registry.QUERY_VALUE)
if err != nil {
k, err = registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\GNU\GnuPG`, registry.QUERY_VALUE)
}
if err != nil {
log.Debug("- FindPinentry: can't open registry")
}
defer k.Close()
installDir, _, err := k.GetStringValue("Install Directory")
if err != nil {
log.Debug("- FindPinentry: can't get string from registry")
}
extraPaths := []string{}
log.Debug("+ FindPinentry()")
cmds := []string{
"pinentry-gtk-2.exe",
"pinentry-qt4.exe",
"pinentry-w32.exe",
"pinentry.exe",
}
// First, look where the registry points
for _, c := range cmds {
full := filepath.Join(installDir, c)
log.Debug("| (registry) Looking for %s", full)
_, err := exec.LookPath(full)
if err == nil {
return full, nil
}
}
// Look in program files, just in case
extraPaths = append(extraPaths, os.Getenv("ProgramFiles"))
extraPaths = append(extraPaths, os.Getenv("ProgramFiles(x86)"))
for _, ep := range extraPaths {
for _, c := range cmds {
full := filepath.Join(ep, "GNU", "GnuPG", c)
log.Debug("| Looking for %s", full)
_, err := exec.LookPath(full)
if err == nil {
return full, nil
}
}
}
log.Debug("- FindPinentry: none found")
return "", fmt.Errorf("No pinentry found, checked a bunch of different places")
}
示例6: Trace
func Trace(log logger.Logger, msg string, f func() error) func() {
log.Debug("+ %s", msg)
return func() { log.Debug("- %s -> %s", msg, ErrToOk(f())) }
}