mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-06-24 18:36:23 +03:00
PySimLogger: move cmd2 import to where it is needed
The PySimLogger has a dependency to cmd2, however this dependency is only required in one specific corner case. We can move the import to the related code section and remove the dependency for all other cases. Change-Id: Idfdfcd27eef8d87bea75230600c7be1e7a8ba749 Related: SYS#6959
This commit is contained in:
+1
-1
@@ -24,7 +24,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from cmd2 import style
|
|
||||||
|
|
||||||
class _PySimLogHandler(logging.Handler):
|
class _PySimLogHandler(logging.Handler):
|
||||||
def __init__(self, log_callback):
|
def __init__(self, log_callback):
|
||||||
@@ -121,6 +120,7 @@ class PySimLogger:
|
|||||||
if isinstance(color, str):
|
if isinstance(color, str):
|
||||||
PySimLogger.print_callback(color + formatted_message + "\033[0m")
|
PySimLogger.print_callback(color + formatted_message + "\033[0m")
|
||||||
else:
|
else:
|
||||||
|
from cmd2 import style
|
||||||
PySimLogger.print_callback(style(formatted_message, fg = color))
|
PySimLogger.print_callback(style(formatted_message, fg = color))
|
||||||
else:
|
else:
|
||||||
PySimLogger.print_callback(formatted_message)
|
PySimLogger.print_callback(formatted_message)
|
||||||
|
|||||||
Reference in New Issue
Block a user