Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(logger): use name instead of file for logger base #562

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ from gallia.log import get_logger, setup_logging, Loglevel
# The logfile's loglevel is Loglevel.DEBUG.
# It can be set with the keyword argument file_level.
setup_logging(level=Loglevel.INFO)
logger = get_logger(__file__)
logger = get_logger(__name__)
logger.info("hello world")
logger.debug("hello debug")
```
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/command/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def json(self) -> str:
return msgspec.json.encode(self).decode()


logger = get_logger(__file__)
logger = get_logger(__name__)


if sys.platform.startswith("linux") or sys.platform == "darwin":
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/command/uds.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from gallia.services.uds.ecu import ECU
from gallia.services.uds.helpers import raise_for_error

logger = get_logger(__file__)
logger = get_logger(__name__)


class UDSScanner(Scanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/discover/doip.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
VehicleAnnouncementMessage,
)

logger = get_logger(__file__)
logger = get_logger(__name__)


class DoIPDiscoverer(AsyncScript):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/discover/find_xcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from gallia.transports import RawCANTransport, TargetURI
from gallia.utils import auto_int, can_id_repr

logger = get_logger(__file__)
logger = get_logger(__name__)


class FindXCP(AsyncScript):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/discover/uds/isotp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from gallia.transports import ISOTPTransport, RawCANTransport, TargetURI
from gallia.utils import auto_int, can_id_repr, write_target_list

logger = get_logger(__file__)
logger = get_logger(__name__)


class IsotpDiscoverer(UDSDiscoveryScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/fuzz/uds/pdu.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from gallia.transports import RawCANTransport, TargetURI
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class PDUFuzzer(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/dtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from gallia.services.uds.core.utils import g_repr
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class DTCPrimitive(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/ecu_reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from gallia.services.uds.core.utils import g_repr
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class ECUResetPrimitive(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/iocbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from gallia.services.uds.core.utils import g_repr
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class IOCBIPrimitive(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/pdu.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from gallia.services.uds.helpers import raise_for_error
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class SendPDUPrimitive(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from gallia.services.uds.core.service import NegativeResponse
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class PingPrimitive(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/rdbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from gallia.services.uds.core.service import NegativeResponse
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class ReadByIdentifierPrimitive(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/rmba.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from gallia.services.uds.core.utils import g_repr
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class RMBAPrimitive(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/rtcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from gallia.services.uds.core.utils import g_repr
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class RTCLPrimitive(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/vin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from gallia.log import get_logger
from gallia.services.uds.core.service import NegativeResponse

logger = get_logger(__file__)
logger = get_logger(__name__)


class VINPrimitive(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/wdbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from gallia.services.uds import NegativeResponse, UDSResponse
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class WriteByIdentifierPrimitive(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/primitive/uds/wmba.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from gallia.services.uds.core.utils import g_repr
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class WMBAPrimitive(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/scan/uds/identifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from gallia.services.uds.helpers import suggests_service_not_supported
from gallia.utils import ParseSkips, auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class ScanIdentifiers(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/scan/uds/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from gallia.services.uds.core.utils import g_repr, uds_memory_parameters
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class MemoryFunctionsScanner(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/scan/uds/reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from gallia.services.uds.helpers import suggests_sub_function_not_supported
from gallia.utils import ParseSkips, auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class ResetScanner(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/scan/uds/sa_dump_seeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from gallia.services.uds.core.utils import g_repr
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class SASeedsDumper(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/scan/uds/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from gallia.services.uds.core.utils import g_repr
from gallia.utils import ParseSkips, auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class ServicesScanner(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/scan/uds/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from gallia.services.uds.core.utils import g_repr
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


class SessionsScanner(UDSScanner):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/commands/script/vecu.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
dynamic_attr_prefix = "dynamic_attr_"


logger = get_logger(__file__)
logger = get_logger(__name__)


class VirtualECU(AsyncScript):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/db/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def bytes_repr(data: bytes) -> str:
INSERT OR IGNORE INTO version VALUES('main', '{schema_version}');
"""

logger = get_logger(__file__)
logger = get_logger(__name__)


class DBHandler:
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/dumpcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from gallia.transports import TargetURI, TransportScheme
from gallia.utils import auto_int, split_host_port

logger = get_logger(__file__)
logger = get_logger(__name__)


if sys.platform.startswith("linux") or sys.platform == "darwin":
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/powersupply.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from gallia.log import get_logger
from gallia.transports import TargetURI

logger = get_logger(__file__)
logger = get_logger(__name__)


class PowerSupplyURI(TargetURI):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/services/uds/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class UDSRequestConfig:
tags: list[str] | None = None


logger = get_logger(__file__)
logger = get_logger(__name__)


class UDSClient:
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/services/uds/core/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
uds_memory_parameters,
)

logger = get_logger(__file__)
logger = get_logger(__name__)

# ****************
# * Base classes *
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/services/uds/ecu.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __repr__(self) -> str:
return f'{type(self).__name__}({", ".join(f"{key}={g_repr(value)}" for key, value in self.__dict__.items())})'


logger = get_logger(__file__)
logger = get_logger(__name__)


class ECU(UDSClient):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/services/uds/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from gallia.services.uds.ecu import ECUState
from gallia.transports import TargetURI

logger = get_logger(__file__)
logger = get_logger(__name__)


class UDSServer(ABC):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/services/xcp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from gallia.transports import BaseTransport
from gallia.transports.can import RawCANTransport

logger = get_logger(__file__)
logger = get_logger(__name__)


class XCPService:
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from gallia.transports.schemes import TransportScheme
from gallia.utils import join_host_port

logger = get_logger(__file__)
logger = get_logger(__name__)


class TargetURI:
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/transports/can.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from gallia.transports.base import BaseTransport, TargetURI
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)

CANFD_MTU = 72
CAN_MTU = 16
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/transports/doip.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from gallia.transports.base import BaseTransport, TargetURI
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)


@unique
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/transports/isotp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from gallia.transports.base import BaseTransport, TargetURI
from gallia.utils import auto_int

logger = get_logger(__file__)
logger = get_logger(__name__)

# Socket Constants not available in the socket module,
# see linux/can/isotp.h
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/transports/tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from gallia.log import get_logger
from gallia.transports.base import BaseTransport, LinesTransportMixin, TargetURI

logger = get_logger(__file__)
logger = get_logger(__name__)


class TCPTransport(BaseTransport, scheme="tcp"):
Expand Down
2 changes: 1 addition & 1 deletion src/gallia/transports/unix.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from gallia.log import get_logger
from gallia.transports.base import BaseTransport, LinesTransportMixin, TargetURI

logger = get_logger(__file__)
logger = get_logger(__name__)


class UnixTransport(BaseTransport, scheme="unix"):
Expand Down
Loading