Coverage for seedboxsync/core/database/models/log.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.17.0, created at 2026-10-31 17:10 +0000

1# 

2# Copyright (C) 2015-2026 Guillaume Kulakowski <guillaume@kulakowski.fr> 

3# 

4# For the full copyright and license information, please view the LICENSE 

5# file that was distributed with this source code. 

6# 

7"""Peewee DAO model for application log records.""" 

8 

9import datetime 

10from peewee import AutoField, CharField, DateTimeField, TextField 

11from seedboxsync.core.database.models import SeedboxSyncModel 

12 

13 

14class Log(SeedboxSyncModel): 

15 """ 

16 Data Access Object (DAO) representing an application log record. 

17 

18 Attributes: 

19 id: Auto-incremented primary key. 

20 level: Human-readable severity, such as ``INFO`` or ``ERROR``. 

21 logger: Name of the logger that emitted the record. 

22 module: Module of the logger that emitted the record. 

23 message: Formatted log message. 

24 timestamp: Date and time when the record was created. 

25 """ 

26 

27 id = AutoField(help_text="Unique identifier of the log record") 

28 level = CharField(max_length=20, default="", help_text="Severity level of the record (e.g. DEBUG, INFO, WARNING, ERROR, CRITICAL)") 

29 logger = CharField(max_length=255, default="", help_text="Name of the logger that emitted the record") 

30 module = CharField(max_length=255, default="", help_text="Module of the logger that emitted the record") 

31 message = TextField(default="", help_text="Formatted message recorded by the logger") 

32 timestamp = DateTimeField(default=datetime.datetime.now, help_text="Date and time when the log record was created")