Example #1
0
 def load(self):
     with data.open("config.json", "r") as f:
         self.__setstate__(json.load(f))
Example #2
0
# -*- coding: utf-8 -*-
import logging
import mod.data
import mod.args
import sys


formatter = logging.Formatter("%(asctime)s %(name)s %(levelname)s: %(message)s")

data = mod.data.Data("log")

allfile = logging.StreamHandler(data.open("all.log", "a"))
stderr = logging.StreamHandler(sys.stderr)

allfile.setLevel(logging.NOTSET)
allfile.setFormatter(formatter)
stderr.setLevel(logging.INFO)
stderr.setFormatter(formatter)

log = logging.getLogger()
log.addHandler(allfile)
log.addHandler(stderr)
log.setLevel(logging.NOTSET)

get = log.getChild
Example #3
0
 def save(self):
     with data.open("config.json", "w") as f:
         json.dump(self.__getstate__(), f, sort_keys=True, indent=4)
         f.write("\n")