From 5da9e7990efdd9cc1b512c239cdccdcdd1360cf3 Mon Sep 17 00:00:00 2001 From: theonepath Date: Tue, 3 May 2022 23:28:44 +0100 Subject: [PATCH] Moved package modules into clog All files related to the clog package have been moved into the directory space "clog/" to separate project repository from package itself, and allows for the building of the package tool via pip. Added a __version__.py file to contain all important attributes about the package. --- __init__.py | 4 ---- clog/__init__.py | 1 + clog/__version__.py | 9 +++++++++ _logger.py => clog/_logger.py | 4 ++-- {utils => clog/utils}/__init__.py | 0 {utils => clog/utils}/common.py | 0 {utils => clog/utils}/printfmt.py | 0 main.py | 19 ------------------- 8 files changed, 12 insertions(+), 25 deletions(-) delete mode 100644 __init__.py create mode 100644 clog/__init__.py create mode 100644 clog/__version__.py rename _logger.py => clog/_logger.py (99%) rename {utils => clog/utils}/__init__.py (100%) rename {utils => clog/utils}/common.py (100%) rename {utils => clog/utils}/printfmt.py (100%) delete mode 100644 main.py diff --git a/__init__.py b/__init__.py deleted file mode 100644 index afa0d8a..0000000 --- a/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from ._logger import * -from .utils.common import * -#from .utils.printfmt import * -from .utils import printfmt \ No newline at end of file diff --git a/clog/__init__.py b/clog/__init__.py new file mode 100644 index 0000000..0faf7a4 --- /dev/null +++ b/clog/__init__.py @@ -0,0 +1 @@ +from ._logger import Logger \ No newline at end of file diff --git a/clog/__version__.py b/clog/__version__.py new file mode 100644 index 0000000..2883328 --- /dev/null +++ b/clog/__version__.py @@ -0,0 +1,9 @@ +__title__ = "clog" +__description__ = "Logging as simple as putting on a shoe." +__url__ = "https://git.closedless.xyz/TheOnePath/clog" +__version__ = "0.1.0" +__author__ = "Ethan Smith-Coss" +__author_email__ = "ethan.sc@closedless.xyz" +__license__ = "GNU GPLv3+" +__copyright__ = "Copyright 2022 Ethan Smith-Coss" +__biscuit__ = "\U0001f36a" \ No newline at end of file diff --git a/_logger.py b/clog/_logger.py similarity index 99% rename from _logger.py rename to clog/_logger.py index 28cfaa5..816bd24 100644 --- a/_logger.py +++ b/clog/_logger.py @@ -4,8 +4,8 @@ from io import TextIOWrapper from typing import TextIO, Union from collections import namedtuple -from utils import common -from utils.printfmt import * +from .utils import common +from .utils.printfmt import * class Logger: ... # class delcaration diff --git a/utils/__init__.py b/clog/utils/__init__.py similarity index 100% rename from utils/__init__.py rename to clog/utils/__init__.py diff --git a/utils/common.py b/clog/utils/common.py similarity index 100% rename from utils/common.py rename to clog/utils/common.py diff --git a/utils/printfmt.py b/clog/utils/printfmt.py similarity index 100% rename from utils/printfmt.py rename to clog/utils/printfmt.py diff --git a/main.py b/main.py deleted file mode 100644 index 8a99324..0000000 --- a/main.py +++ /dev/null @@ -1,19 +0,0 @@ -if __name__ == "__main__": - import _logger - import time - - logger = _logger.Logger() - - logger.debug("This is a debug message").withConsole() - logger.warn("This is a warning message").withConsole() - logger.error("This is an error message").withConsole() - - logger.debug("A message to file but not TTY") - - msg = "Checking if 1 + 1 = 2..." - logger.debug(msg, end="\r").withConsole() - time.sleep(1) - if 1 + 2 != 2: - logger.error(msg + "failed.").withConsole() - else: - logger.debug(msg + "ok.").withConsole() \ No newline at end of file