-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
executable file
·57 lines (45 loc) · 1.64 KB
/
__init__.py
File metadata and controls
executable file
·57 lines (45 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
import logging
from .html5 import *
from .mariaDB import *
from .plantillas import *
class eventos:
def __init__(self, modulo):
self.directorio = 'logs/'
self.fichero = self.directorio + modulo + '.log'
# logging.basicConfig(filename=self.fichero, level=logging.DEBUG,
# format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
def config():
self.fichero = self.directorio + modulo + '.log'
logging.basicConfig(filename=self.fichero, level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
return print(self.fichero)
def debug(self, mensaje):
logging.debug(mensaje)
def info(self, mensaje):
logging.info(mensaje)
def warning(self, mensaje):
logging.warning(mensaje)
def error(self, mensaje):
logging.error(mensaje)
def critical(self, mensaje):
logging.critical(mensaje)
# Programa principal
try:
if __name__ == '__main__':
try:
instancia = eventos('configApp')
instancia.debug('__init__.py ejecutado.')
except 'Error de ejecucion':
import sys
instancia = eventos('configApp')
instancia.error(sys.exc_info())
else:
# import html5, mariaDB, plantillas
# logging.basicConfig(filename='logs/configApp.log', level=logging.DEBUG,
# format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# logging.debug('importado.')
pass
except ImportError:
print('error al importar __init__.py')