Pretty print JSON when dumping
Closes https://git.vvvvvvaria.org/decentral1se/xbotlib/issues/8.
This commit is contained in:
parent
e0cc4203d3
commit
8e7db79903
|
@ -3,6 +3,7 @@
|
|||
# xbotlib 0.16.0 (2021-01-??)
|
||||
|
||||
- Fix logging of exceptions and increase info for stack traces ([#2](https://github.com/decentral1se/xbotlib/issues/2))
|
||||
- Format JSON to human readable when saving ([#8](https://git.vvvvvvaria.org/decentral1se/xbotlib/issues/8))
|
||||
|
||||
# xbotlib 0.15.2 (2021-01-24)
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class SimpleDatabase(dict):
|
|||
"""Save the databse to disk."""
|
||||
try:
|
||||
with open(self.filename, "w") as handle:
|
||||
handle.write(dumps(self))
|
||||
handle.write(dumps(self, indent=2, sort_keys=True))
|
||||
except Exception as exception:
|
||||
message = f"Saving file storage failed: {exception}"
|
||||
self.log.error(message)
|
||||
|
|
Loading…
Reference in New Issue