mirror of
https://github.com/zoriya/Autopipe.git
synced 2026-06-08 09:10:31 +00:00
Setting up the argument parser and the logger
This commit is contained in:
@@ -1 +1,4 @@
|
||||
from .autopipe import Autopipe
|
||||
from input import *
|
||||
from output import *
|
||||
from pipe import *
|
||||
|
||||
+11
-1
@@ -1,5 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
import autopipe
|
||||
import logging
|
||||
from argparse import ArgumentParser
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
autopipe.Autopipe()
|
||||
parser = ArgumentParser(description="Easily run advanced pipelines in a daemon or in one run sessions.")
|
||||
parser.add_argument("coordinator", help="The name of your pipeline coordinator.")
|
||||
parser.add_argument("-v", "--verbose", choices=["debug", "info", "warn", "error"], nargs="?", const="info",
|
||||
default="warn", dest="log_level", metavar="loglevel",
|
||||
help="Set the logging level.", type=str.lower)
|
||||
args = parser.parse_args()
|
||||
|
||||
autopipe.Autopipe(args.coordinator, log_level=getattr(logging, args.log_level.upper()))
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import logging
|
||||
|
||||
|
||||
class Autopipe:
|
||||
def __init__(self):
|
||||
def __init__(self, coordinator, log_level=logging.WARNING):
|
||||
logging.basicConfig(format="%(levelname)s: %(message)s", level=log_level)
|
||||
print("Hello from autopipe")
|
||||
pass
|
||||
logging.info(f"Using coordinator: {coordinator}")
|
||||
|
||||
Reference in New Issue
Block a user