
* Initial work on #19816 * Use TZ-aware timestamps * Deserialize JobLogEntry timestamp * Repurpose RQJobStatusColumn to display job entry level badges * Misc cleanup * Test logging * Refactor HTML templates * Update documentation
22 lines
413 B
Python
22 lines
413 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)
|