mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-01 15:13:27 +02:00
- Adopt Ruff `I` (isort) rules for consistent import sorting - Add two `# isort: split` boundaries to keep required imports pinned in `__init__.py` modules
21 lines
412 B
Python
21 lines
412 B
Python
import logging
|
|
from dataclasses import dataclass, field
|
|
from datetime import datetime
|
|
|
|
from django.utils import timezone
|
|
|
|
__all__ = (
|
|
'JobLogEntry',
|
|
)
|
|
|
|
|
|
@dataclass
|
|
class JobLogEntry:
|
|
level: str
|
|
message: str
|
|
timestamp: datetime = field(default_factory=timezone.now)
|
|
|
|
@classmethod
|
|
def from_logrecord(cls, record: logging.LogRecord):
|
|
return cls(record.levelname.lower(), record.msg)
|