Skip to content

Commit

Permalink
refactor: move logging into cli
Browse files Browse the repository at this point in the history
  • Loading branch information
steveoh committed Feb 7, 2023
1 parent a12e9bc commit a590f3f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 0 additions & 8 deletions row.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from itertools import islice
from os import environ
from pathlib import Path
from sys import stdout

import cv2
import google.cloud.logging
Expand All @@ -22,13 +21,6 @@
from pdf2image import convert_from_bytes
from pdf2image.exceptions import PDFInfoNotInstalledError, PDFPageCountError, PDFSyntaxError

logging.basicConfig(
stream=stdout,
format="%(levelname)-7s %(asctime)s %(module)10s:%(lineno)5s %(message)s",
datefmt="%m-%d %H:%M:%S",
level=logging.INFO,
)

if "PY_ENV" in environ and environ["PY_ENV"] == "production":
client = google.cloud.logging.Client()
client.setup_logging()
Expand Down
9 changes: 9 additions & 0 deletions row_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,21 @@
python row_cli.py image convert ./test-data/multiple_page.pdf --save-to=./test
"""

import logging
from pathlib import Path
from sys import stdout

from docopt import docopt

import row

logging.basicConfig(
stream=stdout,
format="%(levelname)-7s %(asctime)s %(module)10s:%(lineno)5s %(message)s",
datefmt="%m-%d %H:%M:%S",
level=logging.INFO,
)


def main():
"""doc string"""
Expand Down

0 comments on commit a590f3f

Please sign in to comment.