Aggregate all logs found in a directory to a zipball
(ZipHandle, LogDirPath)
| 855 | ParsePackagesDir(os.path.join(ROOT_PATH, 'System/Library/Extensions/')) |
| 856 | |
| 857 | def AggregateLogsDir(ZipHandle, LogDirPath): |
| 858 | ''' Aggregate all logs found in a directory to a zipball ''' |
| 859 | |
| 860 | NbLogFiles = 0 |
| 861 | |
| 862 | for Root, Dirs, Files in os.walk(LogDirPath): |
| 863 | for File in Files: |
| 864 | FilePath = os.path.join(Root, File) |
| 865 | try: |
| 866 | ZipHandle.write(FilePath) |
| 867 | PrintAndLog(u'Log file ' + FilePath.decode('utf-8') + u' added to the logs zipball', 'INFO') |
| 868 | except: |
| 869 | PrintAndLog(FilePath.decode('utf-8') + u' aggregation FAILED', 'ERROR') |
| 870 | NbLogFiles += 1 |
| 871 | |
| 872 | if NbLogFiles == 0: |
| 873 | PrintAndLog(LogDirPath.decode('utf-8') + u' is empty', 'INFO') |
| 874 | |
| 875 | def AggregateLogs(ZipLogsFile): |
| 876 | ''' Walk in the different log directories to add all logs to a zipball ''' |
no test coverage detected