-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Switched Trending and user API, the new one is more stable. * Introduced logging. It'll be very useful to understand what the code is doing, and why something broke. * Reworked detect_dead_link() which broke recently.
- Loading branch information
nanometer5088
committed
Feb 4, 2023
1 parent
978d6f9
commit c4b5aa1
Showing
11 changed files
with
138 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,4 +131,5 @@ dmypy.json | |
#Project files | ||
Likes.txt | ||
features-missing.txt | ||
/video | ||
/video | ||
/logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.3 | ||
0.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from src.logs import Logging | ||
logtofile = Logging().log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import glob | ||
import os | ||
import time | ||
|
||
class Logging: | ||
def __init__(self): | ||
self.logFileOpened = False | ||
|
||
def log(self, stringToLog: str): | ||
# creating logs folder | ||
try: | ||
os.mkdir(os.getcwd() + "/logs") | ||
except FileExistsError: | ||
pass | ||
filenames = [] | ||
for filename in glob.glob(r"logs/log-*.txt"): | ||
filenames.append(int(filename[9:-4])) | ||
if len(filenames) == 0: | ||
filenames.append(0) | ||
if self.logFileOpened: | ||
with open(f"logs/log-{max(filenames)}.txt", "a") as logFile: | ||
logFile.write(f"[{time.strftime('%Y.%m.%d-%H.%M.%S', time.localtime(time.time()))}]" | ||
f" {stringToLog.encode('ascii', 'replace').decode()}\n") | ||
else: | ||
with open(f"logs/log-{max(filenames) + 1}.txt", "w") as logFile: | ||
self.logFileOpened = True | ||
logFile.write(f"[{time.strftime('%Y.%m.%d-%H.%M.%S', time.localtime(time.time()))}]" | ||
f" {stringToLog.encode('ascii', 'replace').decode()}\n") |
Oops, something went wrong.