Skip to content

Commit

Permalink
refacto: use plugin title from metadata to name the logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed May 13, 2024
1 parent fcbcba2 commit 43368e0
Show file tree
Hide file tree
Showing 19 changed files with 38 additions and 20 deletions.
3 changes: 2 additions & 1 deletion qgis_resource_sharing/collection_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from qgis.PyQt.QtCore import QObject, pyqtSignal

from qgis_resource_sharing import config
from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.config import (
COLLECTION_INSTALLED_STATUS,
COLLECTION_NOT_INSTALLED_STATUS,
Expand All @@ -19,7 +20,7 @@
resources_path,
)

LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)


class CollectionInstaller(QObject):
Expand Down
2 changes: 1 addition & 1 deletion qgis_resource_sharing/gui/resource_sharing_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

# -- GLOBALS
FORM_CLASS, _ = uic.loadUiType(str(ui_path("resource_sharing_dialog_base.ui")))
LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)
REPOSITORY_ITEM = 1000
COLLECTION_ITEM = 2000

Expand Down
3 changes: 2 additions & 1 deletion qgis_resource_sharing/network_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
from qgis.PyQt.QtCore import QCoreApplication, QUrl
from qgis.PyQt.QtNetwork import QNetworkReply, QNetworkRequest

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.utilities import qgis_version

LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)


class NetworkManager(object):
Expand Down
3 changes: 2 additions & 1 deletion qgis_resource_sharing/repository_handler/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
from qgis.core import Qgis
from six import add_metaclass

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.config import COLLECTION_NOT_INSTALLED_STATUS
from qgis_resource_sharing.exception import MetadataError
from qgis_resource_sharing.network_manager import NetworkManager
from qgis_resource_sharing.version_compare import isCompatible

LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)


class RepositoryHandlerMeta(type):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
from urllib.parse import urljoin
from urllib.request import pathname2url

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.repository_handler.base import BaseRepositoryHandler
from qgis_resource_sharing.utilities import local_collection_path

LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)


class FileSystemHandler(BaseRepositoryHandler):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
from giturlparse import parse, validate
from qgis.core import QgsApplication

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.repository_handler.base import BaseRepositoryHandler
from qgis_resource_sharing.utilities import local_collection_path

LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)


class writeOut:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

from qgis.PyQt.QtCore import QTemporaryFile

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.network_manager import NetworkManager
from qgis_resource_sharing.repository_handler.base import BaseRepositoryHandler
from qgis_resource_sharing.utilities import local_collection_path

LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)


class RemoteZipHandler(BaseRepositoryHandler):
Expand Down
3 changes: 2 additions & 1 deletion qgis_resource_sharing/repository_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from qgis.PyQt.QtCore import QObject, QTemporaryFile

from qgis_resource_sharing import config
from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.collection_manager import CollectionManager
from qgis_resource_sharing.config import COLLECTION_INSTALLED_STATUS
from qgis_resource_sharing.exception import MetadataError
Expand All @@ -17,7 +18,7 @@
repositories_cache_path,
)

LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)


class RepositoryManager(QObject):
Expand Down
3 changes: 2 additions & 1 deletion qgis_resource_sharing/resource_handler/checklist_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

from qgis.core import QgsApplication

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.resource_handler.base import BaseResourceHandler

CHECKLISTS_FOLDER = "checklists"
CHECKLISTS = "checklists" # Resource Sharing collection subdirectory name
LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)


class ChecklistHandler(BaseResourceHandler):
Expand Down
3 changes: 2 additions & 1 deletion qgis_resource_sharing/resource_handler/expression_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

from qgis.core import QgsSettings

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.resource_handler.base import BaseResourceHandler
from qgis_resource_sharing.utilities import user_expressions_group

hasExprBuilder = False


LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)
EXPRESSIONS = "expressions"


Expand Down
3 changes: 2 additions & 1 deletion qgis_resource_sharing/resource_handler/model_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
from processing.tools.system import mkdir, userFolder
from qgis.core import QgsApplication

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.resource_handler.base import BaseResourceHandler

MODELS_PROCESSING_FOLDER = "models"
MODELS = "models" # Resource Sharing collection subdirectory name
LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)


class ModelHandler(BaseResourceHandler):
Expand Down
3 changes: 2 additions & 1 deletion qgis_resource_sharing/resource_handler/processing_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
from processing.script import ScriptUtils
from qgis.core import QgsApplication

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.resource_handler.base import BaseResourceHandler

LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)
PROCESSING = "processing"


Expand Down
3 changes: 2 additions & 1 deletion qgis_resource_sharing/resource_handler/r_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
from processing.tools.system import mkdir, userFolder
from qgis.core import QgsApplication

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.resource_handler.base import BaseResourceHandler

RSCRIPTS_PROCESSING_FOLDER = "rscripts" # Processing folder for R scripts
RSCRIPTS_FOLDER = "rscripts" # Collection subfolder name
LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)


class RScriptHandler(BaseResourceHandler):
Expand Down
3 changes: 2 additions & 1 deletion qgis_resource_sharing/resource_handler/style_handler.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import logging
from pathlib import Path

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.resource_handler.base import BaseResourceHandler
from qgis_resource_sharing.resource_handler.symbol_resolver_mixin import (
SymbolResolverMixin,
)

LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)
STYLE = "style"


Expand Down
3 changes: 2 additions & 1 deletion qgis_resource_sharing/resource_handler/svg_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

from qgis.core import Qgis, QgsSettings

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.resource_handler.base import BaseResourceHandler
from qgis_resource_sharing.utilities import local_collection_path

SVG = "svg"
LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)


class SVGResourceHandler(BaseResourceHandler):
Expand Down
3 changes: 2 additions & 1 deletion qgis_resource_sharing/resource_handler/symbol_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

from qgis.core import QgsStyle

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.resource_handler.base import BaseResourceHandler
from qgis_resource_sharing.resource_handler.symbol_resolver_mixin import (
SymbolResolverMixin,
)
from qgis_resource_sharing.symbol_xml_extractor import SymbolXMLExtractor
from qgis_resource_sharing.utilities import qgis_version

LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)
SYMBOL = "symbol"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
from qgis.core import QgsApplication
from qgis.PyQt.QtCore import QFile, QFileInfo, QUrl

from qgis_resource_sharing.__about__ import __title__
from qgis_resource_sharing.utilities import path_leaf

LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)


class SymbolResolverMixin(object):
Expand Down
4 changes: 3 additions & 1 deletion qgis_resource_sharing/symbol_xml_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
from qgis.PyQt.QtCore import QFile, QIODevice
from qgis.PyQt.QtXml import QDomDocument

LOGGER = logging.getLogger("QGIS Resource Sharing")
from qgis_resource_sharing.__about__ import __title__

LOGGER = logging.getLogger(__title__)


class SymbolXMLExtractor(object):
Expand Down
4 changes: 2 additions & 2 deletions qgis_resource_sharing/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from qgis.PyQt.QtCore import QDir

from qgis_resource_sharing import config
from qgis_resource_sharing.__about__ import DIR_PLUGIN_ROOT
from qgis_resource_sharing.__about__ import DIR_PLUGIN_ROOT, __title__

LOGGER = logging.getLogger("QGIS Resource Sharing")
LOGGER = logging.getLogger(__title__)

SUPPORTED_RESOURCES_MAP = {
"svg": "SVG",
Expand Down

0 comments on commit 43368e0

Please sign in to comment.