Skip to content

Instantly share code, notes, and snippets.

@basith374
Created February 26, 2019 07:38
Show Gist options
  • Save basith374/263dc0644856b7a65c8ed4913700619b to your computer and use it in GitHub Desktop.
Save basith374/263dc0644856b7a65c8ed4913700619b to your computer and use it in GitHub Desktop.
construct code, pre tags for sending email error logs
def error_msg(msg):
styles = {
'background': '#f4f4f4',
'border': '1px solid #ddd',
'border-left': '3px solid #f36d33',
'color': '#666',
'page-break-inside': 'avoid',
'font-family': 'monospace',
'font-size': '13px',
'line-height': '1.6',
'margin-bottom': '1.6em',
'max-width': '100%',
'overflow': 'auto',
'padding': '1em 1.5em',
'display': 'block',
'word-wrap': 'break-word',
'border-radius': '4px',
}
styles = ';'.join(['{}:{}'.format(x, styles[x]) for x in styles])
return '<code><pre style="{}">{}</pre></code>'.format(styles, msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment