Skip to content

Commit

Permalink
rnd
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyNikiforov authored Jul 16, 2023
1 parent a36fa61 commit 90690c9
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
25 changes: 25 additions & 0 deletions rnd_rich.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from rich.progress import track
import time
import logging

from icloudpd.logger import setup_logger

# logger = logging.getLogger("icloudpd")
# logger.disabled = False
# logger.setLevel(logging.INFO)

# logger = setup_logger()

# does not work
# logging.basicConfig(
# format="%(asctime)s %(levelname)-8s %(message)s",
# datefmt="%Y-%m-%d %H:%M:%S", level=logging.DEBUG)

# works without any configs

for i in track(range(1,10)):
# for i in range(1,10):
# logger.warning(f"Value is {i}")
logging.warning(f"Before value is {i}")
time.sleep(1)
logging.warning(f"After value is {i}")
21 changes: 21 additions & 0 deletions rnd_tqdm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import tqdm
import time
import logging
from tqdm.contrib.logging import logging_redirect_tqdm

from icloudpd.logger import setup_logger

# does not work
# logger = setup_logger()
# logger.setLevel(logging.DEBUG)

# works
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s %(levelname)-8s %(message)s", datefmt="%Y-%m-%d %H:%M:%S")

with logging_redirect_tqdm():
for i in tqdm.tqdm(range(1,10)):
# for i in range(1,10):
# logger.warning(f"Value is {i}")
logging.debug(f"Before Value is {i}")
time.sleep(1)
logging.info(f"After Value is {i}")

0 comments on commit 90690c9

Please sign in to comment.