Skip to content

Commit ff04455

Browse files
authored
Merge pull request #57 from APLA-Toolbox/improve-perf-states
Fix logger bug
2 parents 5f448a1 + fa64b8a commit ff04455

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

jupyddl/automated_planner.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from .dijkstra import DijkstraBestFirstSearch
44
from .a_star import AStarBestFirstSearch
55
from .heuristics import goal_count_heuristic, zero_heuristic
6-
import coloredlogs, logging
6+
import coloredlogs
7+
import logging
78
import julia
89

910
_ = julia.Julia(compiled_modules=False, debug=False)
@@ -25,15 +26,22 @@ def __init__(self, domain_path, problem_path, log_level="DEBUG"):
2526
self.available_heuristics["goal_count"] = goal_count_heuristic
2627
self.available_heuristics["zero"] = zero_heuristic
2728

28-
# Logging
29+
# Logger
30+
self.__init_logger(log_level)
31+
self.logger = logging.getLogger("automated_planning")
32+
coloredlogs.install(level=log_level)
33+
34+
def __init_logger(self, log_level):
35+
import os
36+
37+
if not os.path.exists("logs"):
38+
os.makedirs("logs")
2939
logging.basicConfig(
3040
filename="logs/main.log",
3141
format="%(levelname)s:%(message)s",
3242
filemode="w",
3343
level=log_level,
3444
) # Creates the log file
35-
self.logger = logging.getLogger("automated_planning")
36-
coloredlogs.install(level=log_level)
3745

3846
def transition(self, state, action):
3947
return self.pddl.transition(self.domain, state, action, check=False)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
setuptools.setup(
1111
name="jupyddl", # Replace with your own username
12-
version="0.2.5",
12+
version="0.2.6",
1313
author="Erwin Lejeune",
1414
author_email="erwinlejeune.pro@gmail.com",
1515
description="Jupyddl is a PDDL planner built on top of a Julia parser",

0 commit comments

Comments
 (0)