You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
withopen(f"{relative_to_logs('ioc.log')}", "a") as logFile:
840
+
logFile.write(logHeader)
841
+
842
+
# if the first line of ioc.log is different from currentVersion
843
+
withopen(f"{relative_to_logs('ioc.log')}") as checkVer:
844
+
firstlineVer = checkVer.readline().rstrip()
845
+
if firstlineVer != currentVersion:
846
+
# Delete everything inside the file and append logHeader.
847
+
withopen(f"{relative_to_logs('ioc.log')}", "w+") as logFile:
848
+
logFile.write(logHeader)
849
+
850
+
# if the file exceeds 1000 lines, delete everything and append logHeader to the file.
851
+
withopen(f"{relative_to_logs('ioc.log')}", "r") as logFile:
852
+
iflen(logFile.readlines()) >1000:
853
+
withopen(f"{relative_to_logs('ioc.log')}", "w") as logFile:
854
+
logFile.write(logHeader)
855
+
856
+
# Append the log to the file.
857
+
858
+
if timeNeeded ==True:
859
+
withopen(f"{relative_to_logs('ioc.log')}", "a") as logFile:
860
+
logFile.write(f"{currentTime} - {log}\n")
861
+
else:
862
+
withopen(f"{relative_to_logs('ioc.log')}", "a") as logFile:
863
+
logFile.write(f"{log}\n")
864
+
865
+
if debugMode ==True:
866
+
returnprint(f"DEBUG LOG: {log}")
867
+
868
+
logRoutine(
869
+
f"\n\n[OK] ===> Python loaded. Starting new instance at PID: {pid} | UTS: {get_timestamp()}\n",
870
+
False,
871
+
)
872
+
873
+
```
874
+
875
+
796
876
## π License
797
877
798
878
Permissions of this strong copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights.
0 commit comments