Skip to content

Commit 4b3768d

Browse files
authored
Add formatter for logging. Suppress some packages logging (#66)
1 parent 75f8a30 commit 4b3768d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: osia/cli.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,18 @@ def main_cli():
194194
It sets up the cli and starts the executor."""
195195
parser = _setup_parser()
196196
args = parser.parse_args()
197+
198+
coloredlogs.DEFAULT_FIELD_STYLES.update(filename=dict(color='blue'))
199+
fmt: str = "%(asctime)s %(filename)12s:%(lineno)-5i %(levelname)-8s %(message)s"
200+
197201
if vars(args).get('verbose', False):
198-
coloredlogs.install(level='DEBUG')
202+
coloredlogs.install(fmt=fmt, level=logging.DEBUG)
199203
else:
200-
coloredlogs.install(level='INFO')
204+
coloredlogs.install(fmt=fmt, level=logging.INFO)
205+
201206
logging.captureWarnings(True)
202207

208+
for package in ["urllib3", "git"]:
209+
logging.getLogger(package).setLevel(logging.INFO)
210+
203211
args.func(args)

0 commit comments

Comments
 (0)