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

View file

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

View file

@ -141,7 +141,9 @@ module Log : sig
| `Logout of Name.t * Ipaddr.V4.t * int | `Logout of Name.t * Ipaddr.V4.t * int
| `Startup | `Startup
| `Unikernel_start of Name.t * int * string list * string option | `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 val name : log_event -> Name.t