mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
New job "log": logs a new event
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
parent
c2496d97cc
commit
0af7b5f83d
2 changed files with 11 additions and 0 deletions
|
@ -71,6 +71,16 @@ func (srv *Server) Events(job *engine.Job) engine.Status {
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: this is a shim to allow breaking up other parts of Server without
|
||||
// dragging the sphagetti dependency along.
|
||||
func (srv *Server) Log(job *engine.Job) engine.Status {
|
||||
if len(job.Args) != 3 {
|
||||
return job.Errorf("usage: %s ACTION ID FROM", job.Name)
|
||||
}
|
||||
srv.LogEvent(job.Args[0], job.Args[1], job.Args[2])
|
||||
return engine.StatusOK
|
||||
}
|
||||
|
||||
func (srv *Server) LogEvent(action, id, from string) *utils.JSONMessage {
|
||||
now := time.Now().UTC().Unix()
|
||||
jm := utils.JSONMessage{Status: action, ID: id, From: from, Time: now}
|
||||
|
|
|
@ -105,6 +105,7 @@ func InitServer(job *engine.Job) engine.Status {
|
|||
"history": srv.ImageHistory,
|
||||
"viz": srv.ImagesViz,
|
||||
"container_copy": srv.ContainerCopy,
|
||||
"log": srv.Log,
|
||||
"logs": srv.ContainerLogs,
|
||||
"changes": srv.ContainerChanges,
|
||||
"top": srv.ContainerTop,
|
||||
|
|
Loading…
Reference in a new issue