Add file
This commit is contained in:
20
barcode_server/notifier/file.py
Normal file
20
barcode_server/notifier/file.py
Normal file
@ -0,0 +1,20 @@
|
||||
import logging
|
||||
# import time as sleep
|
||||
|
||||
from prometheus_async.aio import time
|
||||
|
||||
from barcode_server.barcode import BarcodeEvent
|
||||
from barcode_server.notifier import BarcodeNotifier
|
||||
from barcode_server.stats import FILE_NOTIFIER_TIME
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
class FileNotifier(BarcodeNotifier):
|
||||
|
||||
def __init__(self, path: str):
|
||||
super().__init__()
|
||||
self.path = path
|
||||
|
||||
@time(FILE_NOTIFIER_TIME)
|
||||
async def _send_event(self, event: BarcodeEvent):
|
||||
LOGGER.debug(f"Notified {self.path}: {event.barcode}")
|
Reference in New Issue
Block a user