updates to python based logging to use module named loggers, updated logging config file to align with these changes
This commit is contained in:
parent
55d5bb3859
commit
69652ac577
63 changed files with 717 additions and 606 deletions
|
@ -13,6 +13,8 @@ from core.gui.graph.graph import CanvasGraph
|
|||
from core.gui.themes import PADX, PADY
|
||||
from core.gui.widgets import image_chooser
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
|
||||
|
@ -167,5 +169,5 @@ class CanvasWallpaperDialog(Dialog):
|
|||
try:
|
||||
self.canvas.set_wallpaper(filename)
|
||||
except FileNotFoundError:
|
||||
logging.error("invalid background: %s", filename)
|
||||
logger.error("invalid background: %s", filename)
|
||||
self.destroy()
|
||||
|
|
|
@ -18,6 +18,8 @@ from core.gui.dialogs.dialog import Dialog
|
|||
from core.gui.themes import FRAME_PAD, PADX, PADY
|
||||
from core.gui.widgets import CodeText, ConfigFrame, ListboxScroll
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
from core.gui.coreclient import CoreClient
|
||||
|
@ -97,7 +99,7 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
if service_config:
|
||||
for key, value in service_config.config.items():
|
||||
self.config[key].value = value
|
||||
logging.info("default config: %s", self.default_config)
|
||||
logger.info("default config: %s", self.default_config)
|
||||
for file, data in service_config.templates.items():
|
||||
self.modified_files.add(file)
|
||||
self.temp_service_files[file] = data
|
||||
|
@ -181,7 +183,7 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
self.modes_combobox.bind("<<ComboboxSelected>>", self.handle_mode_changed)
|
||||
self.modes_combobox.grid(row=0, column=1, sticky=tk.EW, pady=PADY)
|
||||
|
||||
logging.info("config service config: %s", self.config)
|
||||
logger.info("config service config: %s", self.config)
|
||||
self.config_frame = ConfigFrame(tab, self.app, self.config)
|
||||
self.config_frame.draw_config()
|
||||
self.config_frame.grid(sticky=tk.NSEW, pady=PADY)
|
||||
|
@ -328,7 +330,7 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
def handle_mode_changed(self, event: tk.Event) -> None:
|
||||
mode = self.modes_combobox.get()
|
||||
config = self.mode_configs[mode]
|
||||
logging.info("mode config: %s", config)
|
||||
logger.info("mode config: %s", config)
|
||||
self.config_frame.set_values(config)
|
||||
|
||||
def update_template_file_data(self, event: tk.Event) -> None:
|
||||
|
@ -350,7 +352,7 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
|
||||
def click_defaults(self) -> None:
|
||||
self.node.config_service_configs.pop(self.service_name, None)
|
||||
logging.info(
|
||||
logger.info(
|
||||
"cleared config service config: %s", self.node.config_service_configs
|
||||
)
|
||||
self.temp_service_files = dict(self.original_service_files)
|
||||
|
@ -358,7 +360,7 @@ class ConfigServiceConfigDialog(Dialog):
|
|||
self.template_text.text.delete(1.0, "end")
|
||||
self.template_text.text.insert("end", self.temp_service_files[filename])
|
||||
if self.config_frame:
|
||||
logging.info("resetting defaults: %s", self.default_config)
|
||||
logger.info("resetting defaults: %s", self.default_config)
|
||||
self.config_frame.set_values(self.default_config)
|
||||
|
||||
def click_copy(self) -> None:
|
||||
|
|
|
@ -13,6 +13,8 @@ from core.gui.nodeutils import NodeDraw
|
|||
from core.gui.themes import FRAME_PAD, PADX, PADY
|
||||
from core.gui.widgets import CheckboxList, ListboxScroll, image_chooser
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
|
||||
|
@ -209,7 +211,7 @@ class CustomNodesDialog(Dialog):
|
|||
name, node_draw.image_file, list(node_draw.services)
|
||||
)
|
||||
self.app.guiconfig.nodes.append(custom_node)
|
||||
logging.info("saving custom nodes: %s", self.app.guiconfig.nodes)
|
||||
logger.info("saving custom nodes: %s", self.app.guiconfig.nodes)
|
||||
self.app.save_config()
|
||||
self.destroy()
|
||||
|
||||
|
@ -219,7 +221,7 @@ class CustomNodesDialog(Dialog):
|
|||
image_file = str(Path(self.image_file).absolute())
|
||||
custom_node = CustomNode(name, image_file, list(self.services))
|
||||
node_draw = NodeDraw.from_custom(custom_node)
|
||||
logging.info(
|
||||
logger.info(
|
||||
"created new custom node (%s), image file (%s), services: (%s)",
|
||||
name,
|
||||
image_file,
|
||||
|
@ -239,7 +241,7 @@ class CustomNodesDialog(Dialog):
|
|||
node_draw.image_file = str(Path(self.image_file).absolute())
|
||||
node_draw.image = self.image
|
||||
node_draw.services = set(self.services)
|
||||
logging.debug(
|
||||
logger.debug(
|
||||
"edit custom node (%s), image: (%s), services (%s)",
|
||||
node_draw.model,
|
||||
node_draw.image_file,
|
||||
|
|
|
@ -7,6 +7,8 @@ from core.gui.appconfig import SCRIPT_PATH
|
|||
from core.gui.dialogs.dialog import Dialog
|
||||
from core.gui.themes import FRAME_PAD, PADX
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
|
||||
|
@ -83,6 +85,6 @@ class ExecutePythonDialog(Dialog):
|
|||
def script_execute(self) -> None:
|
||||
file = self.file_entry.get()
|
||||
options = self.option_entry.get()
|
||||
logging.info("Execute %s with options %s", file, options)
|
||||
logger.info("Execute %s with options %s", file, options)
|
||||
self.app.core.execute_script(file)
|
||||
self.destroy()
|
||||
|
|
|
@ -6,6 +6,8 @@ from typing import TYPE_CHECKING, Optional
|
|||
from core.gui.dialogs.dialog import Dialog
|
||||
from core.gui.themes import FRAME_PAD, PADX, PADY
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
|
||||
|
@ -139,8 +141,8 @@ class FindDialog(Dialog):
|
|||
_x, _y, _, _ = canvas_node.canvas.bbox(canvas_node.id)
|
||||
oid = canvas_node.canvas.find_withtag("rectangle")
|
||||
x0, y0, x1, y1 = canvas_node.canvas.bbox(oid[0])
|
||||
logging.debug("Dist to most left: %s", abs(x0 - _x))
|
||||
logging.debug("White canvas width: %s", abs(x0 - x1))
|
||||
logger.debug("Dist to most left: %s", abs(x0 - _x))
|
||||
logger.debug("White canvas width: %s", abs(x0 - x1))
|
||||
|
||||
# calculate the node's location
|
||||
# (as fractions of white canvas's width and height)
|
||||
|
|
|
@ -17,6 +17,8 @@ from core.gui.dialogs.emaneconfig import EmaneModelDialog
|
|||
from core.gui.themes import FRAME_PAD, PADX, PADY
|
||||
from core.gui.widgets import ListboxScroll, image_chooser
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
from core.gui.graph.node import CanvasNode
|
||||
|
@ -261,7 +263,7 @@ class NodeConfigDialog(Dialog):
|
|||
|
||||
if nutils.is_rj45(self.node):
|
||||
ifaces = self.app.core.client.get_ifaces()
|
||||
logging.debug("host machine available interfaces: %s", ifaces)
|
||||
logger.debug("host machine available interfaces: %s", ifaces)
|
||||
ifaces_scroll = ListboxScroll(frame)
|
||||
ifaces_scroll.listbox.config(state=state)
|
||||
ifaces_scroll.grid(
|
||||
|
|
|
@ -12,6 +12,8 @@ from core.gui.dialogs.dialog import Dialog
|
|||
from core.gui.themes import FRAME_PAD, PADX, PADY
|
||||
from core.gui.widgets import CheckboxList, ListboxScroll
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
|
||||
|
@ -131,7 +133,7 @@ class NodeConfigServiceDialog(Dialog):
|
|||
|
||||
def click_save(self) -> None:
|
||||
self.node.config_services = self.current_services.copy()
|
||||
logging.info("saved node config services: %s", self.node.config_services)
|
||||
logger.info("saved node config services: %s", self.node.config_services)
|
||||
self.destroy()
|
||||
|
||||
def click_cancel(self) -> None:
|
||||
|
|
|
@ -9,6 +9,8 @@ from core.gui.dialogs.dialog import Dialog
|
|||
from core.gui.themes import FRAME_PAD, PADX, PADY, scale_fonts
|
||||
from core.gui.validation import LARGEST_SCALE, SMALLEST_SCALE
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
|
||||
|
@ -102,7 +104,7 @@ class PreferencesDialog(Dialog):
|
|||
|
||||
def theme_change(self, event: tk.Event) -> None:
|
||||
theme = self.theme.get()
|
||||
logging.info("changing theme: %s", theme)
|
||||
logger.info("changing theme: %s", theme)
|
||||
self.app.style.theme_use(theme)
|
||||
|
||||
def click_save(self) -> None:
|
||||
|
|
|
@ -20,6 +20,8 @@ from core.gui.images import ImageEnum
|
|||
from core.gui.themes import FRAME_PAD, PADX, PADY
|
||||
from core.gui.widgets import CodeText, ListboxScroll
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
from core.gui.coreclient import CoreClient
|
||||
|
@ -393,7 +395,7 @@ class ServiceConfigDialog(Dialog):
|
|||
1.0, "end"
|
||||
)
|
||||
else:
|
||||
logging.debug("file already existed")
|
||||
logger.debug("file already existed")
|
||||
|
||||
def delete_filename(self) -> None:
|
||||
cbb = self.filename_combobox
|
||||
|
@ -601,7 +603,7 @@ class ServiceConfigDialog(Dialog):
|
|||
i = dirs.index(d)
|
||||
self.dir_list.listbox.delete(i)
|
||||
except ValueError:
|
||||
logging.debug("directory is not in the list")
|
||||
logger.debug("directory is not in the list")
|
||||
self.directory_entry.delete(0, "end")
|
||||
|
||||
def directory_select(self, event) -> None:
|
||||
|
|
|
@ -10,6 +10,8 @@ from core.gui.dialogs.dialog import Dialog
|
|||
from core.gui.themes import PADX, PADY
|
||||
from core.gui.widgets import ConfigFrame
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
|
||||
|
@ -55,7 +57,7 @@ class SessionOptionsDialog(Dialog):
|
|||
try:
|
||||
session_id = self.app.core.session.id
|
||||
result = self.app.core.client.set_session_options(session_id, config)
|
||||
logging.info("saved session config: %s", result)
|
||||
logger.info("saved session config: %s", result)
|
||||
except grpc.RpcError as e:
|
||||
self.app.show_grpc_exception("Set Session Options Error", e)
|
||||
self.destroy()
|
||||
|
|
|
@ -12,6 +12,8 @@ from core.gui.images import ImageEnum
|
|||
from core.gui.task import ProgressTask
|
||||
from core.gui.themes import PADX, PADY
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.gui.app import Application
|
||||
|
||||
|
@ -31,7 +33,7 @@ class SessionsDialog(Dialog):
|
|||
def get_sessions(self) -> List[SessionSummary]:
|
||||
try:
|
||||
sessions = self.app.core.client.get_sessions()
|
||||
logging.info("sessions: %s", sessions)
|
||||
logger.info("sessions: %s", sessions)
|
||||
return sorted(sessions, key=lambda x: x.id)
|
||||
except grpc.RpcError as e:
|
||||
self.app.show_grpc_exception("Get Sessions Error", e)
|
||||
|
@ -175,7 +177,7 @@ class SessionsDialog(Dialog):
|
|||
self.selected_id = None
|
||||
self.delete_button.config(state=tk.DISABLED)
|
||||
self.connect_button.config(state=tk.DISABLED)
|
||||
logging.debug("selected session: %s", self.selected_session)
|
||||
logger.debug("selected session: %s", self.selected_session)
|
||||
|
||||
def click_connect(self) -> None:
|
||||
if not self.selected_session:
|
||||
|
@ -199,7 +201,7 @@ class SessionsDialog(Dialog):
|
|||
def click_delete(self) -> None:
|
||||
if not self.selected_session:
|
||||
return
|
||||
logging.info("click delete session: %s", self.selected_session)
|
||||
logger.info("click delete session: %s", self.selected_session)
|
||||
self.tree.delete(self.selected_id)
|
||||
self.app.core.delete_session(self.selected_session)
|
||||
session_id = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue