Skip to content

Commit 7b8025d

Browse files
fix: avoid invoking twice & chang log name
1 parent c632659 commit 7b8025d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

graphgen/generate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def main():
6565
"GraphGen with unique ID %s logging to %s",
6666
unique_id,
6767
os.path.join(
68-
working_dir, "logs", f"graphgen_{output_data_type}_{unique_id}.log"
68+
working_dir, "logs", f"{unique_id}_graphgen_{output_data_type}.log"
6969
),
7070
)
7171

graphgen/utils/log.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,19 @@
99
def set_logger(
1010
log_file: str,
1111
log_level: int = logging.INFO,
12+
*,
1213
if_stream: bool = True,
1314
max_bytes: int = 50 * 1024 * 1024, # 50 MB
1415
backup_count: int = 5,
16+
force: bool = False,
1517
):
18+
19+
if logger.hasHandlers() and not force:
20+
return
21+
22+
if force:
23+
logger.handlers.clear()
24+
1625
logger.setLevel(log_level)
1726
logger.propagate = False
1827

0 commit comments

Comments
 (0)