from llogger import LLogger log = LLogger() log.access("pippo") log.unknown_id("123.234.345.456") log.psw_error("pippo") log.panic("pippo") log.admin("admin_name") log.user_del("admin_name", "pippo") log.user_del_error("admin_name", "pippo", "user not found"); log.invalid_op("admin_name"); log.user_ins("admin_name", "pippo") log.user_ins_error("admin_name", "pippo", "user already exists"); #FORMAT = '%(asctime)-15s \t %(clientip)s \t %(user)-8s \t %(message)s' #logging.basicConfig(filename='example.log',format=FORMAT) #d = {'clientip': '192.168.0.1', 'user': '******'} #logger = logging.getLogger('tcpserver') #logger.warning('Protocol problem: %s', 'connection reset', extra=d)
#!/usr/bin/env python # -*- coding: utf8 -*- import RPi.GPIO as GPIO import mfrc522.MFRC522 as MFRC522 import signal, datetime import json, time, threading, Queue from display import i2c_lcd from util import write_display, read_input, notification_daemon from llogger import LLogger log = LLogger() TYPE_ADMIN = 'admin' TYPE_USER = '******' SECURITY_CODE = '70' #Objeto timer definido em escopo global t = None # Capture SIGINT for cleanup when the script is aborted def end_read(signal,frame): global continue_reading print "Ctrl+C captured, ending read." continue_reading = False GPIO.cleanup() #Escreve as opções do administrador def write_admin_options(options_set, lcd): global t