Switch from logrus to glog.
Signed-off-by: Victor Marmol <vmarmol@google.com>
This commit is contained in:
parent
de57f78590
commit
e5636543cc
|
@ -13,7 +13,6 @@ type linuxContainer struct {
|
|||
config *Config
|
||||
state *State
|
||||
cgroupManager CgroupManager
|
||||
logger *logrus.Logger
|
||||
}
|
||||
|
||||
func (c *linuxContainer) ID() string {
|
||||
|
@ -29,7 +28,7 @@ func (c *linuxContainer) RunState() (RunState, error) {
|
|||
}
|
||||
|
||||
func (c *linuxContainer) Processes() ([]int, error) {
|
||||
c.logger.Debug("fetch container processes")
|
||||
glog.Info("fetch container processes")
|
||||
pids, err := c.cgroupManager.GetPids(c.config.Cgroups)
|
||||
if err != nil {
|
||||
return nil, newGenericError(err, SystemError)
|
||||
|
@ -38,7 +37,7 @@ func (c *linuxContainer) Processes() ([]int, error) {
|
|||
}
|
||||
|
||||
func (c *linuxContainer) Stats() (*ContainerStats, error) {
|
||||
c.logger.Debug("fetch container stats")
|
||||
glog.Info("fetch container stats")
|
||||
var (
|
||||
err error
|
||||
stats = &ContainerStats{}
|
||||
|
@ -54,36 +53,36 @@ func (c *linuxContainer) Stats() (*ContainerStats, error) {
|
|||
}
|
||||
|
||||
func (c *linuxContainer) StartProcess(config *ProcessConfig) (int, error) {
|
||||
c.logger.Debug("start new container process")
|
||||
glog.Info("start new container process")
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (c *linuxContainer) Destroy() error {
|
||||
c.logger.Debug("destroy container")
|
||||
glog.Info("destroy container")
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (c *linuxContainer) Pause() error {
|
||||
c.logger.Debug("pause container")
|
||||
glog.Info("pause container")
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (c *linuxContainer) Resume() error {
|
||||
c.logger.Debug("resume container")
|
||||
glog.Info("resume container")
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (c *linuxContainer) Signal(pid, signal int) error {
|
||||
c.logger.Debugf("sending signal %d to pid %d", signal, pid)
|
||||
glog.Infof("sending signal %d to pid %d", signal, pid)
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (c *linuxContainer) Wait() (int, error) {
|
||||
c.logger.Debug("wait container")
|
||||
glog.Info("wait container")
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (c *linuxContainer) WaitProcess(pid int) (int, error) {
|
||||
c.logger.Debugf("wait process %d", pid)
|
||||
glog.Infof("wait process %d", pid)
|
||||
panic("not implemented")
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"path/filepath"
|
||||
"regexp"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -23,14 +23,13 @@ var (
|
|||
)
|
||||
|
||||
// New returns a linux based container factory based in the root directory.
|
||||
func New(root string, logger *logrus.Logger) (Factory, error) {
|
||||
func New(root string) (Factory, error) {
|
||||
if err := os.MkdirAll(root, 0700); err != nil {
|
||||
return nil, newGenericError(err, SystemError)
|
||||
}
|
||||
|
||||
return &linuxFactory{
|
||||
root: root,
|
||||
logger: logger,
|
||||
root: root,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -38,9 +37,6 @@ func New(root string, logger *logrus.Logger) (Factory, error) {
|
|||
type linuxFactory struct {
|
||||
// root is the root directory
|
||||
root string
|
||||
|
||||
// standard logger for all packages
|
||||
logger *logrus.Logger
|
||||
}
|
||||
|
||||
func (l *linuxFactory) Create(id string, config *Config) (Container, error) {
|
||||
|
@ -65,27 +61,26 @@ func (l *linuxFactory) Create(id string, config *Config) (Container, error) {
|
|||
|
||||
func (l *linuxFactory) Load(id string) (Container, error) {
|
||||
containerRoot := filepath.Join(l.root, id)
|
||||
l.logger.Debugf("loading container config from %s", containerRoot)
|
||||
glog.Infof("loading container config from %s", containerRoot)
|
||||
config, err := l.loadContainerConfig(containerRoot)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
l.logger.Debugf("loading container state from %s", containerRoot)
|
||||
glog.Infof("loading container state from %s", containerRoot)
|
||||
state, err := l.loadContainerState(containerRoot)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cgroupManager := newCgroupsManager()
|
||||
l.logger.Debugf("using %s as cgroup manager", cgroupManager)
|
||||
glog.Infof("using %s as cgroup manager", cgroupManager)
|
||||
return &linuxContainer{
|
||||
id: id,
|
||||
root: containerRoot,
|
||||
config: config,
|
||||
state: state,
|
||||
cgroupManager: cgroupManager,
|
||||
logger: l.logger,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -5,13 +5,11 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/codegangsta/cli"
|
||||
)
|
||||
|
||||
var (
|
||||
logPath = os.Getenv("log")
|
||||
logger = logrus.New()
|
||||
argvs = make(map[string]*rFunc)
|
||||
)
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ var statsCommand = cli.Command{
|
|||
}
|
||||
|
||||
func statsAction(context *cli.Context) {
|
||||
factory, err := libcontainer.New(context.GlobalString("root"), logger)
|
||||
factory, err := libcontainer.New(context.GlobalString("root"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue