Example #1
0
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)
Example #2
0
                        q.put(msg)

                    print "{} autenticado".format(ids[uid_str][1])

                    #Usuário comum
                    if ids[uid_str][1] == TYPE_USER:
                        write_display(lcd, "Autorizado")
                        log.access(uid_str)
                        #Sinal de abertura
                        time.sleep(1)

                        write_display(lcd, "Aproxime o cartao")

                    #Administrador
                    elif ids[uid_str][1] == TYPE_ADMIN:
                        log.admin(uid_str)
                        write_display(lcd, "admin")
                        t = threading.Timer(2, write_admin_options, args=(0,lcd))
                        t.start()
                        option = input()
                        t.cancel()

                        if option == 1:
                            write_display (lcd,'Aproxime novo cartao')
                            read_new_card = False
                            while not read_new_card:
                                (status,TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL) 
                                if status == MIFAREReader.MI_OK: 
                                    (status,uid) = MIFAREReader.MFRC522_Anticoll() 
                                    if status == MIFAREReader.MI_OK: 
                                        read_new_card = True