[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] mirage-logs and functoria


  • To: Thomas Leonard <talex5@xxxxxxxxx>, "mirageos-devel@xxxxxxxxxxxxxxxxxxxx" <mirageos-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Drup <drupyog+caml@xxxxxxxx>
  • Date: Tue, 12 Jan 2016 15:00:51 +0100
  • Delivery-date: Tue, 12 Jan 2016 14:01:06 +0000
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=subject:to:references:from:message-id:date:user-agent:mime-version:in-reply-to:content-type; b=EJIzbs284WtSqOwfmj/GKLYGSPweFNmuXCtPAKe/mNn59452qnp71cilm/glK93rUBID+p4Ki+Cj 6B/qeZF1jUNSl8zewkiQwseqEEUuXXmQcd6AyGFtNKRxclqeGn7M
  • List-id: Developer list for MirageOS <mirageos-devel.lists.xenproject.org>

Ideally, I'd like to integrate this with functoria. What would be the
best way to do this?
Is it possible to do something like this?

   register "console" [mirage_logs (main $ default_console)]

Not directly like that. I see several possibilities.

- Make "Main" take an extra module argument
      module L = struct let log = create () |> run end
  then config.ml is now
      let log = default_log $ default_console in
      register "foo" [main $ .. $ log]

This way, the functor application of Mirage_logs.Make is outside (in the "default_log" combinator).
  Maybe it could be combined with Logs.Src.create if that's desirable.

- Change a bit the API, so that you have a `start` function that returns a thread that starts the logger
  (which means no automated function wrapping).

  Then, we declare main differently:
let main = foreign ~deps:[hidden default_log] "Unikernel.Main" ( ... @-> job) `Main.start` will receive an additional value (at least unit, but you can put whatever you want). and that ensures that logs are initialized before the main job is executed.
  This is what is done for nocrypto.

Function wrapping could probably be arranged by using the value passed around.
  In the end, this could be like 1), but without the functor argument.

- The problem with those two methods is similar to your tracing issue. It doesn't log things started before the main job. The third possibility is, we solve https://github.com/mirage/functoria/issues/45 and we add a way to put the logger (and the tracer) there.
  Again, no automated wrapping


_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.