Skip to content

Commit

Permalink
feat: add logging method
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkaroid committed Jun 17, 2022
1 parent 103a76c commit 064bc58
Showing 1 changed file with 55 additions and 3 deletions.
58 changes: 55 additions & 3 deletions tomoe/utils/misc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import janda
import argparse
import os
import logging
import re
from xhtml2pdf import pisa

logging.basicConfig(format="%(asctime)s - %(message)s", level=logging.INFO)


def choose():
my_parser = argparse.ArgumentParser()
Expand All @@ -26,9 +31,6 @@ def choose():
metavar=("PATH", "CHAPTER"),
type=str,
)
my_parser.add_argument(
"--qhentai", "-qhentai", action="store", metavar=("PATH_AFTER_WWW"), type=str
)
my_parser.add_argument(
"--asmhentai", "-asmhentai", action="store", metavar=("ID"), type=int
)
Expand Down Expand Up @@ -142,3 +144,53 @@ def need_args():
bool
"""
return print("No arguments was given")


def log_data(case, note):
"""Logging data
Parameters
----------
case : str
Case of the log
note : str
Note of the log
"""
logging.info(f"{case}: {note}")


def log_file(file: str, size: str, took: str):
"""Logging file
Parameters
----------
case : str
Case of the log
file : str
File name
size : str
File size
took : str
Time took
"""
logging.info(f"Successfully downloaded {file}: {size} MB, took: {took} Seconds")


def log_final(taken: str, total_size: str):
"""Final log
Parameters
----------
taken : str
Time took
total_size : str
Total size
"""
logging.info(
f"Successfully downloaded all images taken {taken} minutes with total size {total_size} MB"
)

0 comments on commit 064bc58

Please sign in to comment.