MCPcopy
hub / github.com/jipegit/OSXAuditor / PrintAndLog

Function PrintAndLog

osxauditor.py:220–252  ·  view source on GitHub ↗

Write a string of log depending of its type and call the function to generate the HTML log or the Syslog if needed

(LogStr, TYPE)

Source from the content-addressed store, hash-verified

218 SYSLOG_SERVER = False
219
220def PrintAndLog(LogStr, TYPE):
221 ''' Write a string of log depending of its type and call the function to generate the HTML log or the Syslog if needed '''
222
223 global HTML_LOG_FILE
224 global SYSLOG_SERVER
225
226 if TYPE == 'INFO' or 'INFO_RAW':
227 print(u'[INFO] ' + LogStr)
228 logging.info(LogStr)
229
230 elif TYPE == 'ERROR':
231 print(u'[ERROR] ' + LogStr)
232 logging.error(LogStr)
233
234 elif TYPE == 'WARNING':
235 print(u'[WARNING] ' + LogStr)
236 logging.warning(LogStr)
237
238 elif TYPE == 'DEBUG':
239 print(u'[DEBUG] ' + LogStr)
240 logging.debug(LogStr)
241
242 elif TYPE == 'SECTION' or TYPE == 'SUBSECTION':
243 SectionTitle = u'\n#########################################################################################################\n'
244 SectionTitle += '# #\n'
245 SectionTitle += '# ' +LogStr+ ' '*(94-len(LogStr)) + '#\n'
246 SectionTitle += '# #\n'
247 SectionTitle += '#########################################################################################################\n'
248 print(SectionTitle)
249 logging.info(u'\n' + SectionTitle)
250
251 if HTML_LOG_FILE:
252 HTMLLog(LogStr, TYPE)
253
254def MHRLookup():
255 ''' Perform of lookup in Team Cymru\'s MHR '''

Callers 15

SyslogSetupFunction · 0.85
MHRLookupFunction · 0.85
VTLookupFunction · 0.85
LocalLookupFunction · 0.85
BigFileMd5Function · 0.85
UniversalReadPlistFunction · 0.85
ParseQuarantinesFunction · 0.85
ParseStartupItemsFunction · 0.85
ParseLaunchAgentsFunction · 0.85
ParseStartupFunction · 0.85
HashDirFunction · 0.85
ParseDownloadsFunction · 0.85

Calls 1

HTMLLogFunction · 0.85

Tested by

no test coverage detected