本文整理汇总了Golang中github.com/Sirupsen/logrus.Debugf函数的典型用法代码示例。如果您正苦于以下问题:Golang Debugf函数的具体用法?Golang Debugf怎么用?Golang Debugf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Debugf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Shutdown
// Shutdown stops the daemon.
func (daemon *Daemon) Shutdown() error {
daemon.shutdown = true
if daemon.containers != nil {
logrus.Debug("starting clean shutdown of all containers...")
daemon.containers.ApplyAll(func(c *container.Container) {
if !c.IsRunning() {
return
}
logrus.Debugf("stopping %s", c.ID)
if err := daemon.shutdownContainer(c); err != nil {
logrus.Errorf("Stop container error: %v", err)
return
}
logrus.Debugf("container stopped %s", c.ID)
})
}
// trigger libnetwork Stop only if it's initialized
if daemon.netController != nil {
daemon.netController.Stop()
}
if daemon.layerStore != nil {
if err := daemon.layerStore.Cleanup(); err != nil {
logrus.Errorf("Error during layer Store.Cleanup(): %v", err)
}
}
if err := daemon.cleanupMounts(); err != nil {
return err
}
return nil
}
开发者ID:float001,项目名称:docker,代码行数:35,代码来源:daemon.go
示例2: NewFlow
// Create a new flow on the table
func (self *Table) NewFlow(match FlowMatch) (*Flow, error) {
// modifications to flowdb requires a lock
self.lock.Lock()
defer self.lock.Unlock()
flow := new(Flow)
flow.Table = self
flow.Match = match
flow.isInstalled = false
flow.FlowID = globalFlowID // FIXME: need a better id allocation
globalFlowID += 1
flow.flowActions = make([]*FlowAction, 0)
log.Debugf("Creating new flow for match: %+v", match)
// See if the flow already exists
flowKey := flow.flowKey()
if self.flowDb[flowKey] != nil {
log.Errorf("Flow %s already exists", flowKey)
return nil, errors.New("Flow already exists")
}
log.Debugf("Added flow: %s", flowKey)
// Save it in DB. We dont install the flow till its next graph elem is set
self.flowDb[flowKey] = flow
return flow, nil
}
开发者ID:jojimt,项目名称:netplugin,代码行数:30,代码来源:fgraphTable.go
示例3: releaseOSSboxResources
func releaseOSSboxResources(osSbox osl.Sandbox, ep *endpoint) {
for _, i := range osSbox.Info().Interfaces() {
// Only remove the interfaces owned by this endpoint from the sandbox.
if ep.hasInterface(i.SrcName()) {
if err := i.Remove(); err != nil {
log.Debugf("Remove interface %s failed: %v", i.SrcName(), err)
}
}
}
ep.Lock()
joinInfo := ep.joinInfo
ep.Unlock()
if joinInfo == nil {
return
}
// Remove non-interface routes.
for _, r := range joinInfo.StaticRoutes {
if err := osSbox.RemoveStaticRoute(r); err != nil {
log.Debugf("Remove route failed: %v", err)
}
}
}
开发者ID:jc-m,项目名称:test-docker-plugin,代码行数:25,代码来源:sandbox.go
示例4: Stdio
// Stdio returns the stdin, stdout, and stderr pipes, respectively. Closing
// these pipes does not close the underlying pipes; it should be possible to
// call this multiple times to get multiple interfaces.
func (process *process) Stdio() (io.WriteCloser, io.ReadCloser, io.ReadCloser, error) {
operation := "Stdio"
title := "HCSShim::Process::" + operation
logrus.Debugf(title+" processid=%d", process.processID)
var stdIn, stdOut, stdErr syscall.Handle
if process.cachedPipes == nil {
var (
processInfo hcsProcessInformation
resultp *uint16
)
err := hcsGetProcessInfo(process.handle, &processInfo, &resultp)
err = processHcsResult(err, resultp)
if err != nil {
return nil, nil, nil, makeProcessError(process, operation, "", err)
}
stdIn, stdOut, stdErr = processInfo.StdInput, processInfo.StdOutput, processInfo.StdError
} else {
// Use cached pipes
stdIn, stdOut, stdErr = process.cachedPipes.stdIn, process.cachedPipes.stdOut, process.cachedPipes.stdErr
// Invalidate the cache
process.cachedPipes = nil
}
pipes, err := makeOpenFiles([]syscall.Handle{stdIn, stdOut, stdErr})
if err != nil {
return nil, nil, nil, err
}
logrus.Debugf(title+" succeeded processid=%d", process.processID)
return pipes[0], pipes[1], pipes[2], nil
}
开发者ID:Florian-9,项目名称:docker,代码行数:38,代码来源:process.go
示例5: Close
// Close cleans up any state associated with the process but does not kill
// or wait on it.
func (process *process) Close() error {
operation := "Close"
title := "HCSShim::Process::" + operation
logrus.Debugf(title+" processid=%d", process.processID)
// Don't double free this
if process.handle == 0 {
return nil
}
if hcsCallbacksSupported {
if err := process.unregisterCallback(); err != nil {
return makeProcessError(process, operation, "", err)
}
}
if err := hcsCloseProcess(process.handle); err != nil {
return makeProcessError(process, operation, "", err)
}
process.handle = 0
logrus.Debugf(title+" succeeded processid=%d", process.processID)
return nil
}
开发者ID:Florian-9,项目名称:docker,代码行数:27,代码来源:process.go
示例6: deleteDatastoreFiles
func (d *Dispatcher) deleteDatastoreFiles(ds *object.Datastore, path string, force bool) (bool, error) {
defer trace.End(trace.Begin(fmt.Sprintf("path %q, force %t", path, force)))
// refuse to delete everything on the datstore, ignore force
if path == "" {
dsn, _ := ds.ObjectName(d.ctx)
msg := fmt.Sprintf("refusing to remove datastore files for path \"\" on datastore %q", dsn)
return false, errors.New(msg)
}
var empty bool
dsPath := ds.Path(path)
res, err := d.lsFolder(ds, dsPath)
if err != nil {
if !types.IsFileNotFound(err) {
err = errors.Errorf("Failed to browse folder %q: %s", dsPath, err)
return empty, err
}
log.Debugf("Folder %q is not found", dsPath)
empty = true
return empty, nil
}
if len(res.File) > 0 && !force {
log.Debugf("Folder %q is not empty, leave it there", dsPath)
return empty, nil
}
m := object.NewFileManager(ds.Client())
if err = d.deleteFilesIteratively(m, ds, dsPath); err != nil {
return empty, err
}
return true, nil
}
开发者ID:vmware,项目名称:vic,代码行数:34,代码来源:store_files.go
示例7: ResizeConsole
// ResizeConsole resizes the console of the process.
func (process *process) ResizeConsole(width, height uint16) error {
operation := "ResizeConsole"
title := "HCSShim::Process::" + operation
logrus.Debugf(title+" processid=%d", process.processID)
modifyRequest := processModifyRequest{
Operation: modifyConsoleSize,
ConsoleSize: &consoleSize{
Height: height,
Width: width,
},
}
modifyRequestb, err := json.Marshal(modifyRequest)
if err != nil {
return err
}
modifyRequestStr := string(modifyRequestb)
var resultp *uint16
err = hcsModifyProcess(process.handle, modifyRequestStr, &resultp)
err = processHcsResult(err, resultp)
if err != nil {
return makeProcessError(process, operation, "", err)
}
logrus.Debugf(title+" succeeded processid=%d", process.processID)
return nil
}
开发者ID:Florian-9,项目名称:docker,代码行数:31,代码来源:process.go
示例8: waitRemove
// waitRemove blocks until either:
// a) the device registered at <device_set_prefix>-<hash> is removed,
// or b) the 10 second timeout expires.
func (devices *DeviceSet) waitRemove(devname string) error {
log.Debugf("[deviceset %s] waitRemove(%s)", devices.devicePrefix, devname)
defer log.Debugf("[deviceset %s] waitRemove(%s) END", devices.devicePrefix, devname)
i := 0
for ; i < 1000; i++ {
devinfo, err := devicemapper.GetInfo(devname)
if err != nil {
// If there is an error we assume the device doesn't exist.
// The error might actually be something else, but we can't differentiate.
return nil
}
if i%100 == 0 {
log.Debugf("Waiting for removal of %s: exists=%d", devname, devinfo.Exists)
}
if devinfo.Exists == 0 {
break
}
devices.Unlock()
time.Sleep(10 * time.Millisecond)
devices.Lock()
}
if i == 1000 {
return fmt.Errorf("Timeout while waiting for device %s to be removed", devname)
}
return nil
}
开发者ID:Crispy1975,项目名称:deis,代码行数:30,代码来源:deviceset.go
示例9: GetSized
// GetSized downloads the named meta file with the given size. A short body
// is acceptable because in the case of timestamp.json, the size is a cap,
// not an exact length.
// If size is "NoSizeLimit", this corresponds to "infinite," but we cut off at a
// predefined threshold "notary.MaxDownloadSize".
func (s HTTPStore) GetSized(name string, size int64) ([]byte, error) {
url, err := s.buildMetaURL(name)
if err != nil {
return nil, err
}
req, err := http.NewRequest("GET", url.String(), nil)
if err != nil {
return nil, err
}
resp, err := s.roundTrip.RoundTrip(req)
if err != nil {
return nil, NetworkError{Wrapped: err}
}
defer resp.Body.Close()
if err := translateStatusToError(resp, name); err != nil {
logrus.Debugf("received HTTP status %d when requesting %s.", resp.StatusCode, name)
return nil, err
}
if size == NoSizeLimit {
size = notary.MaxDownloadSize
}
if resp.ContentLength > size {
return nil, ErrMaliciousServer{}
}
logrus.Debugf("%d when retrieving metadata for %s", resp.StatusCode, name)
b := io.LimitReader(resp.Body, size)
body, err := ioutil.ReadAll(b)
if err != nil {
return nil, err
}
return body, nil
}
开发者ID:Mic92,项目名称:docker,代码行数:37,代码来源:httpstore.go
示例10: loadLayer
func (l *tarexporter) loadLayer(filename string, rootFS image.RootFS, id string, progressOutput progress.Output) (layer.Layer, error) {
rawTar, err := os.Open(filename)
if err != nil {
logrus.Debugf("Error reading embedded tar: %v", err)
return nil, err
}
defer rawTar.Close()
inflatedLayerData, err := archive.DecompressStream(rawTar)
if err != nil {
return nil, err
}
defer inflatedLayerData.Close()
if progressOutput != nil {
fileInfo, err := os.Stat(filename)
if err != nil {
logrus.Debugf("Error statting file: %v", err)
return nil, err
}
progressReader := progress.NewProgressReader(inflatedLayerData, progressOutput, fileInfo.Size(), stringid.TruncateID(id), "Loading layer")
return l.ls.Register(progressReader, rootFS.ChainID())
}
return l.ls.Register(inflatedLayerData, rootFS.ChainID())
}
开发者ID:RAMESHBABUK,项目名称:docker,代码行数:27,代码来源:load.go
示例11: AddDevice
func (devices *DeviceSet) AddDevice(hash, baseHash string) error {
log.Debugf("[deviceset] AddDevice() hash=%s basehash=%s", hash, baseHash)
defer log.Debugf("[deviceset] AddDevice(hash=%s basehash=%s) END", hash, baseHash)
baseInfo, err := devices.lookupDevice(baseHash)
if err != nil {
return err
}
baseInfo.lock.Lock()
defer baseInfo.lock.Unlock()
devices.Lock()
defer devices.Unlock()
if info, _ := devices.lookupDevice(hash); info != nil {
return fmt.Errorf("device %s already exists", hash)
}
if err := devices.createRegisterSnapDevice(hash, baseInfo); err != nil {
return err
}
return nil
}
开发者ID:Crispy1975,项目名称:deis,代码行数:25,代码来源:deviceset.go
示例12: Put
func (d *Driver) Put(id string) error {
// Protect the d.active from concurrent access
d.Lock()
defer d.Unlock()
mount := d.active[id]
if mount == nil {
logrus.Debugf("Put on a non-mounted device %s", id)
// but it might be still here
if d.Exists(id) {
mergedDir := path.Join(d.dir(id), "merged")
err := syscall.Unmount(mergedDir, 0)
if err != nil {
logrus.Debugf("Failed to unmount %s overlay: %v", id, err)
}
}
return nil
}
mount.count--
if mount.count > 0 {
return nil
}
defer delete(d.active, id)
if mount.mounted {
err := syscall.Unmount(mount.path, 0)
if err != nil {
logrus.Debugf("Failed to unmount %s overlay: %v", id, err)
}
return err
}
return nil
}
开发者ID:ChanderG,项目名称:docker,代码行数:34,代码来源:overlay.go
示例13: makeHttpHandler
func makeHttpHandler(eng *engine.Engine, logging bool, localMethod string, localRoute string, handlerFunc HttpApiFunc, enableCors bool, dockerVersion version.Version) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// log the request
log.Debugf("Calling %s %s", localMethod, localRoute)
if logging {
log.Infof("%s %s", r.Method, r.RequestURI)
}
if strings.Contains(r.Header.Get("User-Agent"), "Docker-Client/") {
userAgent := strings.Split(r.Header.Get("User-Agent"), "/")
if len(userAgent) == 2 && !dockerVersion.Equal(version.Version(userAgent[1])) {
log.Debugf("Warning: client and server don't have the same version (client: %s, server: %s)", userAgent[1], dockerVersion)
}
}
version := version.Version(mux.Vars(r)["version"])
if version == "" {
version = api.APIVERSION
}
if enableCors {
writeCorsHeaders(w, r)
}
if version.GreaterThan(api.APIVERSION) {
http.Error(w, fmt.Errorf("client and server don't have same version (client : %s, server: %s)", version, api.APIVERSION).Error(), http.StatusNotFound)
return
}
if err := handlerFunc(eng, version, w, r, mux.Vars(r)); err != nil {
log.Errorf("Handler for %s %s returned error: %s", localMethod, localRoute, err)
httpError(w, err)
}
}
}
开发者ID:pombredanne,项目名称:docker,代码行数:34,代码来源:server.go
示例14: setupBridge
func (b *Bridge) setupBridge(externalPort string) error {
la := netlink.NewLinkAttrs()
la.Name = b.bridgeName
bridge, _ := netlink.LinkByName(b.bridgeName)
if bridge == nil {
log.Debugf("Bridge %s does not exist ", b.bridgeName)
out, err := exec.Command("ovs-vsctl", "add-br", b.bridgeName).CombinedOutput()
if err != nil {
log.Fatalf("Bridge %s creation failed been created. Resp: %s, err: %s", b.bridgeName, out, err)
}
log.Infof("Bridge %s has been created. Resp: %s", b.bridgeName, out)
out, err = exec.Command("ovs-vsctl", "add-port", b.bridgeName, externalPort).CombinedOutput()
if err != nil {
log.Fatalf("Failed to add external port %s. Resp: %s, err: %s", externalPort, out, err)
}
log.Infof("External port %s has been added to %s. Resp: %s", externalPort, b.bridgeName, out)
out, err = exec.Command("ifconfig", externalPort, "0.0.0.0").CombinedOutput()
if err != nil {
log.Fatalf("Failed to ip address of port %s. Resp: %s, err: %s", externalPort, out, err)
}
log.Infof("Ip address of port %s has been cleaned. Resp: %s", externalPort, out)
return err
} else {
log.Debugf("Bridge %s already exsist", b.bridgeName)
}
return nil
}
开发者ID:akanto,项目名称:dhcp-plugin,代码行数:33,代码来源:ovslib.go
示例15: compareByOrigin
func compareByOrigin(path1, path2 *Path) *Path {
// Select the best path based on origin attribute.
//
// IGP is preferred over EGP; EGP is preferred over Incomplete.
// If both paths have same origin, we return None.
log.Debugf("enter compareByOrigin")
_, attribute1 := path1.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
_, attribute2 := path2.getPathAttr(bgp.BGP_ATTR_TYPE_ORIGIN)
if attribute1 == nil || attribute2 == nil {
log.WithFields(log.Fields{
"Topic": "Table",
"Key": "compareByOrigin",
"Origin1": attribute1,
"Origin2": attribute2,
}).Error("can't compare origin because it's not present")
return nil
}
origin1, n1 := binary.Uvarint(attribute1.(*bgp.PathAttributeOrigin).Value)
origin2, n2 := binary.Uvarint(attribute2.(*bgp.PathAttributeOrigin).Value)
log.Debugf("compareByOrigin -- origin1: %d(%d), origin2: %d(%d)", origin1, n1, origin2, n2)
// If both paths have same origins
if origin1 == origin2 {
return nil
} else if origin1 < origin2 {
return path1
} else {
return path2
}
}
开发者ID:hzhou8,项目名称:gobgp,代码行数:32,代码来源:destination.go
示例16: cleanupMountsFromReader
func (daemon *Daemon) cleanupMountsFromReader(reader io.Reader, unmount func(target string) error) error {
sc := bufio.NewScanner(reader)
var errors []string
for sc.Scan() {
line := sc.Text()
fields := strings.Fields(line)
if strings.HasPrefix(fields[4], daemon.repository) {
logrus.Debugf("Mount base: %v, repository %s", fields[4], daemon.repository)
mnt := fields[4]
mountBase := filepath.Base(mnt)
if mountBase == "mqueue" || mountBase == "shm" {
logrus.Debugf("Unmounting %v", mnt)
if err := unmount(mnt); err != nil {
logrus.Error(err)
errors = append(errors, err.Error())
}
}
}
}
if err := sc.Err(); err != nil {
return err
}
if len(errors) > 0 {
return fmt.Errorf("Error cleaningup mounts:\n%v", strings.Join(errors, "\n"))
}
logrus.Debugf("Cleaning up old shm/mqueue mounts: done.")
return nil
}
开发者ID:nixuw,项目名称:docker,代码行数:31,代码来源:daemon_linux.go
示例17: compareByMED
func compareByMED(path1, path2 *Path) *Path {
// Select the path based with lowest MED value.
//
// If both paths have same MED, return None.
// By default, a route that arrives with no MED value is treated as if it
// had a MED of 0, the most preferred value.
// RFC says lower MED is preferred over higher MED value.
// compare MED among not only same AS path but also all path,
// like bgp always-compare-med
log.Debugf("enter compareByMED")
getMed := func(path *Path) uint32 {
_, attribute := path.getPathAttr(bgp.BGP_ATTR_TYPE_MULTI_EXIT_DISC)
if attribute == nil {
return 0
}
med := attribute.(*bgp.PathAttributeMultiExitDisc).Value
return med
}
med1 := getMed(path1)
med2 := getMed(path2)
log.Debugf("compareByMED -- med1: %d, med2: %d", med1, med2)
if med1 == med2 {
return nil
} else if med1 < med2 {
return path1
}
return path2
}
开发者ID:hzhou8,项目名称:gobgp,代码行数:29,代码来源:destination.go
示例18: findImages
func findImages(cfg *config.CloudConfig) ([]string, error) {
log.Debugf("Looking for images at %s", config.IMAGES_PATH)
result := []string{}
dir, err := os.Open(config.IMAGES_PATH)
if os.IsNotExist(err) {
log.Debugf("Not loading images, %s does not exist")
return result, nil
}
if err != nil {
return nil, err
}
defer dir.Close()
files, err := dir.Readdirnames(0)
if err != nil {
return nil, err
}
for _, fileName := range files {
if ok, _ := path.Match(config.IMAGES_PATTERN, fileName); ok {
log.Debugf("Found %s", fileName)
result = append(result, fileName)
}
}
return result, nil
}
开发者ID:rowhit,项目名称:os,代码行数:30,代码来源:sysinit.go
示例19: ecrImageExists
func ecrImageExists(image *imagename.ImageName, auth docker.AuthConfiguration) (exists bool, err error) {
var (
req *http.Request
res *http.Response
client = &http.Client{}
)
uri := fmt.Sprintf("https://%s/v2/%s/manifests/%s", image.Registry, image.Name, image.Tag)
if req, err = http.NewRequest("GET", uri, nil); err != nil {
return false, err
}
req.SetBasicAuth(auth.Username, auth.Password)
log.Debugf("Request ECR image %s with basic auth %s:****", uri, auth.Username)
if res, err = client.Do(req); err != nil {
return false, fmt.Errorf("Failed to authenticate by realm url %s, error %s", uri, err)
}
defer res.Body.Close()
log.Debugf("Got status %d", res.StatusCode)
if res.StatusCode == 404 {
return false, nil
}
if res.StatusCode != 200 {
// TODO: maybe more descriptive error
return false, fmt.Errorf("GET %s status code %d", uri, res.StatusCode)
}
return true, nil
}
开发者ID:grammarly,项目名称:rocker-compose,代码行数:35,代码来源:registry.go
示例20: LoadEnv
func (c *Context) LoadEnv() (*rancherClient.Environment, error) {
if c.Environment != nil {
return c.Environment, nil
}
projectName := c.sanitizedProjectName()
if _, err := c.loadClient(); err != nil {
return nil, err
}
logrus.Debugf("Looking for stack %s", projectName)
// First try by name
envs, err := c.Client.Environment.List(&rancherClient.ListOpts{
Filters: map[string]interface{}{
"name": projectName,
"removed_null": nil,
},
})
if err != nil {
return nil, err
}
for _, env := range envs.Data {
if strings.EqualFold(projectName, env.Name) {
logrus.Debugf("Found stack: %s(%s)", env.Name, env.Id)
c.Environment = &env
return c.Environment, nil
}
}
// Now try not by name for case sensitive databases
envs, err = c.Client.Environment.List(&rancherClient.ListOpts{
Filters: map[string]interface{}{
"removed_null": nil,
},
})
if err != nil {
return nil, err
}
for _, env := range envs.Data {
if strings.EqualFold(projectName, env.Name) {
logrus.Debugf("Found stack: %s(%s)", env.Name, env.Id)
c.Environment = &env
return c.Environment, nil
}
}
logrus.Infof("Creating stack %s", projectName)
env, err := c.Client.Environment.Create(&rancherClient.Environment{
Name: projectName,
})
if err != nil {
return nil, err
}
c.Environment = env
return c.Environment, nil
}
开发者ID:cloudnautique,项目名称:rancher-compose,代码行数:60,代码来源:context.go
注:本文中的github.com/Sirupsen/logrus.Debugf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论