hardbyte / hardbyte/python-can

TimedRotatingLogger

Offen
#1,364 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Python
Sterne
1.6k
Forks
697
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Is your feature request related to a problem? Please describe.

The existing `SizedRotatingLogger` can be used to frequently (or infrequently) write CAN traces to a file by specifying a maximum file size with the `-s` option. The frequency can become periodic if the number of CAN traces being sent on the bus are _nearly_ consistent or the dominant message(s) are periodic. My specific application involves a remote logger running embedded Linux with a cellular connection that transports the rolled over logged files via secure shell protocol. I have been trying to balance the number of files produced vs. total file size. More importantly thus far, I must limit the number of file transfers from a specific device due to the firewall settings on the server where the files are being transported to. Therefore, my application would be well suited for a `TimedRotatingLogger`, where I can define the amount of time in between rollovers.

### Describe the solution you'd like

The `TimedRotatingLogger` would rollover after the specified amount of time as long as there were CAN messages observed in that time. If no CAN messages were sent on the bus in that time, an empty trace should not be written.

### Describe alternatives you've considered

At this point in time I plan to focus on the implementation of a `TimedRotatingLogger`, but I wonder if both options should be able to be given. For example, if a user supplies a time and file size constraint, the first to occur (timeout or size limit) would trigger the rollover.

### Additional context

The idea of the `TimedRotatingLogger` was (to my knowledge) originally introduced in #1359 by @zariiii9003 in https://github.com/hardbyte/python-can/issues/1359#issuecomment-1207256273.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.