Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made runner work without a logger #16

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions elx/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def run(
async def async_run(
self,
streams: Optional[List[str]] = None,
logger: logging.Logger = None,
logger: Optional[logging.Logger] = None,
) -> None:
state = self.load_state()

Expand All @@ -79,11 +79,12 @@ def writelines(state_line: str):
self.save_state(state)

class LogWriter:
def __init__(self, logger: logging.Logger):
def __init__(self, logger: Optional[logging.Logger]):
self.logger = logger

def writelines(self, line: str):
self.logger.info(line)
if self.logger:
self.logger.info(line)

async with self.tap.process(state=state, streams=streams) as tap_process:
async with self.target.process(tap_process=tap_process) as target_process:
Expand Down
Loading