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
[email protected]
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel