Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import logging
- filepath = os.path.join(os.path.dirname(ALFrameManager.getBehaviorPath(self.behaviorId)), "fileName.txt")
- maybeContains = None
- try:
- with open(filepath, "r") as textfile:
- maybeContains = textfile.readlines()
- except:
- pass
- with open(filepath, "a") as textfile:
- if maybeContains == "":
- agenda = "type1;type2;n"
- textfile.write(agenda)
- textfile.write(storedData)
- else:
- textfile.write(storedData)
- self.onStopped()
- def onLoad(self):
- self.logging.basicConfig(filename="20180712.log", format='%(asctime)s %(levelname)s-8s [%(filename)s:%(lineno)d]%(message)s', level=logging.DEBUG)
- self.logger = self.logging.getLogger("Behavior - Box") `
- Before a command, which should be logged I call
- ` self.logger("what happened here")
- filepath = "/home/nao/myfile.txt"
Add Comment
Please, Sign In to add comment