def errorLog(proc_name, host=None, from_address='', to_address=None, user=None, password=''): """Report the error log :param proc_name: the name of the wrong process :param host: the database server host :param from_address: the email sender :param to_address: the email receiver :param user: the username :param password: the username's password""" from gnr.utils.gnrmail import sendmail ts = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S: ') title = '%s - Error in %s' % (ts, proc_name) print title tb_text = errorTxt() print tb_text.encode('ascii', 'ignore') if (host and to_address): try: sendmail(host=host, from_address=from_address, to_address=to_address, subject=title, body=tb_text, user=user, password=password) except: pass return tb_text
def errorLog(proc_name, host=None, from_address='', to_address=None, user=None, password=''): """Report the error log :param proc_name: the name of the wrong process :param host: the database server host :param from_address: the email sender :param to_address: the email receiver :param user: the username :param password: the username's password""" from gnr.utils.gnrmail import sendmail ts = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S: ') title = '%s - Error in %s' % (ts, proc_name) print title tb_text = errorTxt() print tb_text.encode('ascii', 'ignore') if (host and to_address): try: sendmail(host=host, from_address=from_address, to_address=to_address, subject=title, body=tb_text, user=user, password=password ) except: pass return tb_text
def errorLog(proc_name, host=None, from_address='', to_address=None, user=None, password=''): """add??? :param proc_name: add??? :param host: add???. Default value is ``None`` :param from_address: add???. Default value is `` `` :param to_address: add???. Default value is ``None`` :param user: add???. Default value is ``None`` :param password: add???. Default value is `` `` :returns: add??? """ from gnr.utils.gnrmail import sendmail ts = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S: ') title = '%s - Error in %s' % (ts, proc_name) print title tb_text = errorTxt() print tb_text.encode('ascii', 'ignore') if (host and to_address): try: sendmail(host=host, from_address=from_address, to_address=to_address, subject=title, body=tb_text, user=user, password=password ) except: pass return tb_text