Skip to content

Commit

Permalink
fixed wipe log on max len bug
Browse files Browse the repository at this point in the history
Signed-off-by: Kokonico <kokonico@duck.com>
  • Loading branch information
Kokonico committed Apr 29, 2024
1 parent a00e76a commit 26fda71
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
project = 'ObjLog'
copyright = '2024, Kokonico'
author = 'Kokonico'
release = '2.1.1'
release = '2.1.2'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
3 changes: 2 additions & 1 deletion objlog/Base/LogNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ def __init__(self, name: str, log_file: str | None = None, print_to_console: boo
# chop the file
lines = f.readlines()
lines = lines[-max_log_messages:]
with self.open(log_file, "w") as f2:
with self.open(log_file, "w+") as f2:
f2.writelines(lines)
self.log_len = len(lines)
else:
self.log_len = 0

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ObjLog"
version = "2.1.1"
version = "2.1.2"
description = "Logging, Objectified."
authors = ["Kokonico <kokonico@duck.com>"]
readme = "README.md"
Expand Down

0 comments on commit 26fda71

Please sign in to comment.