-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
84 lines (69 loc) · 2.61 KB
/
settings.py
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import logging
class Null:
pass
EXCLUDED_KEYS = set(Null.__dict__.keys())
class ShellSettings:
LOGO = """
_.._..,_,_
( )
]~,"-.-~~[
.=])' (; ([ Beer2Beer is a 4b Inf project
| ]:: ' [ ITET Leonardo da Vinci, Milazzo (ME)
'=]): .) ([ A working demo of a p2p system!!!
|:: ' |
~~----~~
CONTRIBUTOR(s):
* Antonio Caristia (antonio.caristia at davincimilazzo.edu.it)
* Antonio Trifirò (antonio.trifiro at davincimilazzo.edu.it)
* Francesco Collura (francesco.collura at davincimilazzo.edu.it)
* Francesco Salerno ( francesco.salerno at davincimilazzo.edu.it)
* Letizia Benedetta Mostaccio (letiziabenedetta.mostaccio at davincimilazzo.edu.it)
* Marika Venuto (marika.venuto at davincimilazzo.edu.it)
* Ruben Puglisi ([email protected])
* Salvatore Pagano (salvatore.pagano at davincimilazzo.edu.it)
* Simone Cipriano (simone.cipriano at davincimilazzo.edu.it)
* Simone Romanzo (simone.romanzo at git adddavincimilzzo.edu.it)
* Simone Trovato (simone.trovato at davincimilazzo.edu.it)
* Davide Mento ([email protected])
* Antonio Cutropia ([email protected])
* Michael Basile (michael.basile at davincimilazzo.edu.it)
* Andrea Isgro ([email protected])
"""
USERNAME = None
PASSWORD = None
USER_ID = None
DIRECTORY = None
DIRECTORY_SETTINGS = ".beer2beer"
SERVER_HOST = "localhost"
SERVER_PORT = 8888
PEER_PORT = 9999
@classmethod
def load(cls, records):
for key,value in records.items():
setattr(cls, key, value)
@classmethod
def dict_from_class(cls):
records = {}
for key, value in cls.__dict__.items():
if key not in EXCLUDED_KEYS and not hasattr(value, '__func__'):
records[key] = value
return records
class LoggerSettings:
LOGGER_LEVEL = logging.DEBUG
LOGGER_HANDLER = logging.StreamHandler()
LOGGER_STRING = "[%(asctime)s] - %(name)-6s - %(levelname)-6s - %(message)s"
@classmethod
def get_logger(cls, logger_name=__name__):
# create logger
logger = logging.getLogger(logger_name)
logger.setLevel(cls.LOGGER_LEVEL)
# create console handler and set level to debug
ch = cls.LOGGER_HANDLER
ch.setLevel(cls.LOGGER_LEVEL)
# create formatter
formatter = logging.Formatter(cls.LOGGER_STRING)
# add formatter to ch
ch.setFormatter(formatter)
# add ch to logger
logger.addHandler(ch)
return logger