The problem is that I'm missing logs which happen in init() functions in eggos, due to the order in which init functions run- source files are loaded in alphabetical order, the packages are loaded, and those init functions are added to the run order first, then the ones in the main package.
This means in order to set the log level you need to do something a bit gory like I've done here - create a file which is guaranteed to be parsed first (I prefixed mine with 00_) and have that include a package whose init function only exists to call out to set the log level.
Now if that's the way you want this problem solving, then that's fine (I can keep this approach), but I think a better approach would be to change the build tool to:
Generate a file in the build dir called, for instance, zz_eggos.go (following conventions from tools like the operator SDK)
Write to this file the contents of the current eggos.go file (rather than importing it, which will allow us to avoid the top)
I'd also like to make a minor change to how drivers and stuff are initialised. Rather than having them panic() out, which exits on baremetal and, in my case, clears output (so I can't even see what failed and why) I'd like them to print errors to the console and halt so that the output exists long enough to read. Ignore this, it's an ordering issue with where the panic trap happens, which I will fix.
But I can open a new issue to discuss that design.
Thanks for merging https://github.com/icexin/eggos/pull/96, it's really helped me debug the issues I'm having.
The problem is that I'm missing logs which happen in
init()
functions in eggos, due to the order in which init functions run- source files are loaded in alphabetical order, the packages are loaded, and thoseinit
functions are added to the run order first, then the ones in the main package.This means in order to set the log level you need to do something a bit gory like I've done here - create a file which is guaranteed to be parsed first (I prefixed mine with
00_
) and have that include a package whoseinit
function only exists to call out to set the log level.Now if that's the way you want this problem solving, then that's fine (I can keep this approach), but I think a better approach would be to change the build tool to:
zz_eggos.go
(following conventions from tools like the operator SDK)eggos.go
file (rather than importing it, which will allow us to avoid the top)I'd also like to make a minor change to how drivers and stuff are initialised.
Rather than having themIgnore this, it's an ordering issue with where the panic trap happens, which I will fix.panic()
out, which exits on baremetal and, in my case, clears output (so I can't even see what failed and why) I'd like them to print errors to the console and halt so that the output exists long enough to read.But I can open a new issue to discuss that design.