-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconsole.py
More file actions
34 lines (27 loc) · 1.17 KB
/
Copy pathconsole.py
File metadata and controls
34 lines (27 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Copyright (c) 2022-2025, Foxconn. All rights reserved.
#
# Foxconn and its aiRobots division retain all intellectual property
# and proprietary rights in and to this software, related documentation,
# and any modifications thereto. Any use, reproduction, disclosure, or
# distribution of this software and related documentation without an express
# license agreement from Foxconn is strictly prohibited.
#
# --------------------------------------------------
# system
# --------------------------------------------------
from datetime import datetime
class Console:
enable = True # 控制開關
# ANSI 顏色碼
LIGHT_GREEN = "\033[92m" # 亮綠色
RESET = "\033[0m" # 重置顏色
@staticmethod
def DBG_PRINT(message: str, tag: str = "") -> None:
if Console.enable:
current_time = datetime.now().strftime("%H:%M:%S.%f")[:-3] # 格式化時間
tag_part = f"[{tag}] " if tag else "" # 如果有 tag,拼接到輸出中
print(
f"{Console.LIGHT_GREEN}[{current_time}]{Console.RESET} {tag_part}{message}"
)
# 提供簡化名稱,讓使用者可以直接 import
DBG_PRINT = Console.DBG_PRINT