You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When you created and ran a world with loggers, you often want to do some post-processing. For this it is handy that you can access the loggers that world used. However, this is not possible. Because 1) you pass a class of a logger to the grid world which instantiates a new one for every created world, and 2) because GridWorld does contain the logger instances but as a private object requiring the ugly work around of doing GridWorld._GridWorld__loggers
Describe the solution you would like
I want GridWorld.__loggers to be a Python property that makes it accessible to the public but without a setter so they cannot be altered.
Describe alternatives you have considered
The ugly workaround of acessing a private attribute using GridWorld._GridWorld__loggers
Additional context
Originally identified by @Wouter1 while working on the TuD version of BW4T (see question #267)
The text was updated successfully, but these errors were encountered:
@jwaa Thanks for picking this up!
I'd like to add a few things
I in particular need the log filename that was created, so that I can read the log file contents. Even if I have the logger (I can get it with gridworld.loggers[0]) I still can not get to the filename
You can not access private instance variables. Yes internally they seem to get the name _GridWorld__file_name etc, but python does not allow accessing them from outside. Or maybe I need another trick for this to get around this
And one more thing, maybe relevant. I'm processing after every builder.run so it's not a real problem that the builder creates the loggers. As long as I can get the log file(s) that are made I think I can manage.
The builder creates the loggers yes, but does not store them. This is done by the GridWorld in GridWorld.__loggers. Hence the request to make them accessible as GridWorld.loggers so you don't have the hassle of the double underscore.
Regarding your two bullets; see my suggestion in #267 to make the file name a publicly acessible property. If you are opting to do that by default; good idea that would be a different feature request :)
Is your feature request related to a problem? Please describe.
When you created and ran a world with loggers, you often want to do some post-processing. For this it is handy that you can access the loggers that world used. However, this is not possible. Because 1) you pass a class of a logger to the grid world which instantiates a new one for every created world, and 2) because
GridWorld
does contain the logger instances but as a private object requiring the ugly work around of doingGridWorld._GridWorld__loggers
Describe the solution you would like
I want
GridWorld.__loggers
to be a Python property that makes it accessible to the public but without a setter so they cannot be altered.Describe alternatives you have considered
The ugly workaround of acessing a private attribute using
GridWorld._GridWorld__loggers
Additional context
Originally identified by @Wouter1 while working on the TuD version of BW4T (see question #267)
The text was updated successfully, but these errors were encountered: