Log: new event `Hup

This commit is contained in:
Hannes Mehnert 2018-12-06 22:53:15 +01:00
parent 39bc40353c
commit e28ea84548
3 changed files with 13 additions and 4 deletions

View File

@ -192,6 +192,7 @@ let log_event =
| `C3 n -> `Stop n
in
`Unikernel_stop (to_name name, pid, status')
| `C6 () -> `Hup
and g = function
| `Startup -> `C1 ()
| `Login (name, ip, port) -> `C2 (of_name name, ip, port)
@ -204,6 +205,7 @@ let log_event =
| `Stop n -> `C3 n
in
`C5 (of_name name, pid, status')
| `Hup -> `C6 ()
in
let endp =
Asn.S.(sequence3
@ -212,7 +214,7 @@ let log_event =
(required ~label:"port" int))
in
Asn.S.map f g @@
Asn.S.(choice5
Asn.S.(choice6
(explicit 0 null)
(explicit 1 endp)
(explicit 2 endp)
@ -227,7 +229,8 @@ let log_event =
(required ~label:"status" (choice3
(explicit 0 int)
(explicit 1 int)
(explicit 2 int))))))
(explicit 2 int)))))
(explicit 5 null))
let log_cmd =
let f = function

View File

@ -266,6 +266,7 @@ module Log = struct
| `Startup
| `Unikernel_start of Name.t * int * string list * string option
| `Unikernel_stop of Name.t * int * process_exit
| `Hup
]
let name = function
@ -274,9 +275,10 @@ module Log = struct
| `Logout (name, _, _) -> name
| `Unikernel_start (name, _, _ ,_) -> name
| `Unikernel_stop (name, _, _) -> name
| `Hup -> []
let pp_log_event ppf = function
| `Startup -> Fmt.(pf ppf "startup")
| `Startup -> Fmt.string ppf "startup"
| `Login (name, ip, port) -> Fmt.pf ppf "%a login %a:%d" Name.pp name Ipaddr.V4.pp_hum ip port
| `Logout (name, ip, port) -> Fmt.pf ppf "%a logout %a:%d" Name.pp name Ipaddr.V4.pp_hum ip port
| `Unikernel_start (name, pid, taps, block) ->
@ -285,6 +287,8 @@ module Log = struct
Fmt.(option ~none:(unit "no") string) block
| `Unikernel_stop (name, pid, code) ->
Fmt.pf ppf "%a stopped %d with %a" Name.pp name pid pp_process_exit code
| `Hup -> Fmt.string ppf "hup"
type t = Ptime.t * log_event

View File

@ -141,7 +141,9 @@ module Log : sig
| `Logout of Name.t * Ipaddr.V4.t * int
| `Startup
| `Unikernel_start of Name.t * int * string list * string option
| `Unikernel_stop of Name.t * int * process_exit ]
| `Unikernel_stop of Name.t * int * process_exit
| `Hup
]
val name : log_event -> Name.t