MCPcopy
hub / github.com/PokemonGoF/PokemonGo-Bot / setup_logging

Function setup_logging

pokecli.py:114–144  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

112 return bot
113
114 def setup_logging(config):
115 log_level = logging.ERROR
116
117 if config.debug:
118 log_level = logging.DEBUG
119
120 logging.getLogger("requests").setLevel(log_level)
121 logging.getLogger("websocket").setLevel(log_level)
122 logging.getLogger("socketio").setLevel(log_level)
123 logging.getLogger("engineio").setLevel(log_level)
124 logging.getLogger("socketIO-client").setLevel(log_level)
125 logging.getLogger("pgoapi").setLevel(log_level)
126 logging.getLogger("rpc_api").setLevel(log_level)
127
128 if config.logging:
129 logging_format = '%(message)s'
130 logging_format_options = ''
131
132 if ('show_log_level' not in config.logging) or config.logging['show_log_level']:
133 logging_format = '[%(levelname)s] ' + logging_format
134 if ('show_process_name' not in config.logging) or config.logging['show_process_name']:
135 logging_format = '[%(name)10s] ' + logging_format
136 if ('show_thread_name' not in config.logging) or config.logging['show_thread_name']:
137 logging_format = '[%(threadName)s] ' + logging_format
138 if ('show_datetime' not in config.logging) or config.logging['show_datetime']:
139 logging_format = '[%(asctime)s] ' + logging_format
140 logging_format_options = '%Y-%m-%d %H:%M:%S'
141
142 formatter = Formatter(logging_format,logging_format_options)
143 for handler in logging.root.handlers[:]:
144 handler.setFormatter(formatter)
145
146 def start_bot(bot, config):
147 bot.start()

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected