lundybernard / batconf

Application configuration tool from the BAT project
MIT License
2 stars 0 forks source link

implement __repr__ for manager.Configuration object #9

Closed lundybernard closed 2 months ago

lundybernard commented 2 years ago

provide a helpful string representation of the Configuration object

Since repr should be used for debugging and unambiguous, it should display all the sources, and all of the attribute: value pairs that we know of from those sources. This can probably be accomplished fairly easily by printing the dict values of the configuration and sources recursively

ex:

<batconf.manager.Configuration object at 0x7f2c3e68e8f0>: {
    _config_class: '__main__.GlobalConfig'
    _config_sources: [
         <batconf.sources.dataclass.DataclassConfig at 0x7f2c3e68cfa0>: {
             '_root': '__main__',
             '_data': {
                 'key': 'value', 
                 'key2': None
             }
        },
    ]
}