> On Jan 20, 2020, at 11:41 PM, Nick Rosbrook <rosbro...@gmail.com> wrote: > >> The other option would be to expose the XTL logging levels and let the >> caller set them somehow. > I think this is fine for now. > > For the future, I like using the "functional option" pattern for this > sort of thing. That way, if a user wanted to set a non-default log > level, they could do: > > ctx, err := xenlight.NewContext(xenlight.WithLogLevel(lvl)) > > but if they do not need to specify any options, it's still just: > > ctx, err := xenlight.NewContext()
You know, I somehow remembered the “use a function to set options” pattern (and have a mock-up for that in the “NewType()” patch later), but didn’t notice that such function were variadic. That’s a lot nicer. But really, we need a way to actually create a logger properly. Apparently one thing libvirt does is to create a logger to a file for each guest. That’s something our package users might want to do at some point. -George _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel