mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-15 00:02:17 -06:00
* 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
This commit is contained in:
21
netbox/core/dataclasses.py
Normal file
21
netbox/core/dataclasses.py
Normal file
@@ -0,0 +1,21 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user