MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / clearLogs

Method clearLogs

src/astroprint/software.py:669–688  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

667 return False
668
669 def clearLogs(self):
670 activeLogFiles = ['astrobox.log', 'serial.log', 'electron.log', 'touch.log']
671
672 logsDir = self._settings.getBaseFolder("logs")
673
674 # first delete all old logs
675 for f in os.listdir(logsDir):
676 path = os.path.join(logsDir, f)
677
678 if os.path.isfile(path) and f not in activeLogFiles:
679 os.unlink(path)
680
681 # then truncate the currently used one
682 for f in activeLogFiles:
683 path = os.path.join(logsDir,f)
684 if os.path.isfile(path):
685 with open(path, 'w'):
686 pass
687
688 return True
689
690 @property
691 def systemInfo(self):

Callers

nothing calls this directly

Calls 3

joinMethod · 0.80
unlinkMethod · 0.80
getBaseFolderMethod · 0.45

Tested by

no test coverage detected