Less obtuse logic for polling resource usage when attaching a container

This commit is contained in:
Dane Everitt
2021-01-06 20:36:29 -08:00
parent 3f6eb7e41a
commit 963a906c30
3 changed files with 40 additions and 29 deletions

View File

@@ -2,6 +2,7 @@ package docker
import (
"context"
"github.com/apex/log"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/pterodactyl/wings/api"
@@ -70,6 +71,10 @@ func New(id string, m *Metadata, c *environment.Configuration) (*Environment, er
return e, nil
}
func (e *Environment) log() *log.Entry {
return log.WithField("environment", e.Type()).WithField("container_id", e.Id)
}
func (e *Environment) Type() string {
return "docker"
}