Пример #1
0
 def test_logging_writes_audits(self):
     test_timestamp = time.time()
     app.logger.audit(test_timestamp)
     log_directory = log_dir('error')
     f = open(log_directory, 'r')
     file_content = f.read()
     self.assertTrue(str(test_timestamp) in file_content)
Пример #2
0
 def test_info_logging_writes_to_debug_log(self):
     test_timestamp = time.time()
     app.logger.info(test_timestamp)
     log_directory = log_dir('debug')
     f = open(log_directory, 'r')
     file_content = f.read()
     self.assertTrue(str(test_timestamp) in file_content)
Пример #3
0
def make_log_msg(message, request, log_level, title_number):
    #Constructs the message to submit to audit.
    msg = message + 'Client ip address is: %s. ' % client_ip(request)
    msg = msg + 'Signed in as: %s. ' % linux_user()
    msg = msg + 'Title number is: %s. ' % title_number
    msg = msg + 'Logged at: mint/%s. ' % log_dir(log_level)
    return msg