Skip to content

Instantly share code, notes, and snippets.

View UBarney's full-sized avatar

UBarney

  • beijing
  • 18:16 (UTC +08:00)
View GitHub Profile
@UBarney
UBarney / gist:6bfdcc35eb25a9985cb765da368e102b
Last active July 8, 2017 12:46
log to diffierent file
import logging
class LogHandler(object):
format = '%(levelname)s %(message)s'
files = {
'ERROR': 'error.log',
'CRITICAL': 'error.log',
'WARN': 'warn.log',
}
def write(self, msg):
@UBarney
UBarney / ubuntu_update_package.sh
Created July 6, 2017 02:34
ubuntu_update_package
sudo apt-get update # Fetches the list of available updates
sudo apt-get upgrade # Strictly upgrades the current packages
sudo apt-get dist-upgrade # Installs updates (new ones)
@UBarney
UBarney / Flask - Logging Requests
Created June 28, 2017 06:14 — forked from ivanleoncz/flask_app_logging.py
Logging every request received from Flask.
#/usr/bin/python
import logging
from logging.handlers import RotatingFileHandler
from flask import Flask, request, jsonify
from time import strftime
import traceback
app = Flask(__name__)