Probably it is something simple and obvious, but I can’t find the solution. Does anyone knows how to get parent module of a submodule? By parent module I mean that if we have submodule Foo.Bar
, then it’s parent module is Foo
.
Context: I want to filter logs using shouldlog function and I want to exclude logs of some package. shouldlog
has _module
variable which I want to use for this purpose, but package uses submodules, so I can’t just say _module != Foo
I need to extract somehow required information.
Currently I am doing something like !startswith(string(_module), "Foo")
but it looks very ugly.