120 Star 519 Fork 285

GVPOneOS/OneOS

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
print_helper.py 1.49 KB
一键复制 编辑 原始数据 按行查看 历史
likefei 提交于 2022-11-18 19:51 +08:00 . first merge yaml
# -*- coding: utf-8 -*-
import os
from inspect import currentframe, stack, getmodule
colors = {'cyan': '\033[96m', 'purple': '\033[95m', 'blue': '\033[94m', 'green': '\033[92m', 'yellow': '\033[93m',
'red': '\033[91m', 'end': '\033[0m'}
def print_error(*args):
if os.getenv("logging.level") == "debug":
print(colors.get('red') + "OneOS_ERROR" + "(" + str(stack()[1][1]) + ":" + str(currentframe().f_back.f_lineno) + "):\n" +
colors.get('end'), ' '.join(args))
else:
print(colors.get('red') + "OneOS_ERROR:" + colors.get('end'), ' '.join(args))
def print_warn(*args):
if os.getenv("logging.level") == "debug":
print(colors.get('yellow') + "OneOS_WARN" + "(" + str(stack()[1][1]) + ":" + str(currentframe().f_back.f_lineno) + "):\n" +
colors.get('end'), ' '.join(args))
else:
print(colors.get('yellow') + "OneOS_WARN:" + colors.get('end'), ' '.join(args))
def print_info(*args):
if os.getenv("logging.level") == "debug":
print(colors.get('blue') + "OneOS_INFO" + "(" + str(stack()[1][1]) + ":" + str(currentframe().f_back.f_lineno) + "):\n" +
colors.get('end'), ' '.join(args))
else:
print(' '.join(args))
def print_debug(*args):
if os.getenv("logging.level") == "debug":
print(colors.get('cyan') +
"OneOS_DEBUG" + "(" + str(stack()[1][1]) + ":" + str(currentframe().f_back.f_lineno) + "):\n" +
colors.get('end'),
' '.join(args))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/cmcc-oneos/OneOS.git
git@gitee.com:cmcc-oneos/OneOS.git
cmcc-oneos
OneOS
OneOS
dev

搜索帮助