From: Vincent Hanquez Date: Mon, 7 Sep 2009 10:46:22 +0000 (+0100) Subject: add xenvm unique identifier (vm's uuid) in log when using syslog X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=2064d6e985c498aa74c0747c6f3a6c2dc5ef7891;p=xenclient%2Ftoolstack.git add xenvm unique identifier (vm's uuid) in log when using syslog --- diff --git a/common/debug.ml b/common/debug.ml index 286cddd..3d2b23b 100644 --- a/common/debug.ml +++ b/common/debug.ml @@ -18,9 +18,15 @@ module type BRAND = sig val name: string end +let uid = ref None + module Debugger = functor(Brand: BRAND) -> struct let output (f:string -> ?extra:string -> ('a, unit, string, unit) format4 -> 'a) fmt = - let extra = Brand.name in + let extra = + match !uid with + | None -> Brand.name + | Some uid -> Printf.sprintf "%s|%s" uid Brand.name + in f Brand.name ~extra fmt let debug fmt = output Logs.debug fmt diff --git a/xenvm/xenvm.ml b/xenvm/xenvm.ml index 6ea4473..bc2aea8 100644 --- a/xenvm/xenvm.ml +++ b/xenvm/xenvm.ml @@ -991,6 +991,10 @@ let () = | Some dbg -> dbg ) in + (* register a unique id if we are using syslog *) + if String.startswith "syslog:" a then + Debug.uid := Some uuid; + Logs.set_default Log.Debug [ a ]; Logs.set_default Log.Info [ a ]; Logs.set_default Log.Warn [ a ];