-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
107 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
A test delivery service. Simply logs the messages it receives. | ||
""" | ||
|
||
from typing import Any | ||
|
||
import logging | ||
|
||
import util.LoggingUtil as lu | ||
|
||
from delivery.BaseWriter import BaseWriter | ||
from pdmodels.Models import LogicalDevice, PhysicalDevice | ||
|
||
class LTSLogger(BaseWriter): | ||
def __init__(self) -> None: | ||
super().__init__('ltslogger') | ||
|
||
def on_message(self, pd: PhysicalDevice, ld: LogicalDevice, msg: dict[Any], retry_count: int) -> int: | ||
try: | ||
lu.cid_logger.info(f'{msg}, retry_count = {retry_count}', extra=msg) | ||
return LTSLogger.MSG_OK | ||
|
||
except BaseException: | ||
logging.exception('Error while processing message.') | ||
return LTSLogger.MSG_FAIL | ||
|
||
|
||
if __name__ == '__main__': | ||
LTSLogger().run() | ||
logging.info('Exiting.') |
Oops, something went wrong.