| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- from . import StringFormat
- import sys
- import platform
- platformName = platform.system()
- if platformName == 'Linux':
- from .Linux import LinuxCMDColorPrint
- PrintTool = LinuxCMDColorPrint.LinuxCMDColorPrint()
- elif platformName == 'Windows':
- from .Windows import WindowsCMDColorPrint
- PrintTool = WindowsCMDColorPrint.WindowsCMDColorPrint()
- elif platformName == 'Darwin':
- from .Linux import LinuxCMDColorPrint
- PrintTool = LinuxCMDColorPrint.LinuxCMDColorPrint()
- else:
- PrintTool = None
- def Log(content, noTag=True):
- """
- 打印信息,需要格式化的String,请使用LogFormat
- """
- if noTag:
- content = StringFormat.FormatStdoutString(
- str(content))
- else:
- content = StringFormat.FormatStdoutString(
- str("Debug : %s" % content))
- print(content)
- def LogSuccess(content, noTag=True):
- """
- 打印警告信息
- """
- if noTag:
- content = StringFormat.FormatStdoutString(
- str(content))
- else:
- content = StringFormat.FormatStdoutString(
- str("Debug : %s" % content))
- if PrintTool:
- PrintTool.printGreen(content)
- else:
- print(content)
- def LogWaring(content, noTag=False):
- """
- 打印警告信息
- """
- if noTag:
- content = StringFormat.FormatStdoutString(
- str(content))
- else:
- content = StringFormat.FormatStdoutString(
- str("Waring : %s" % content))
- if PrintTool:
- PrintTool.printYellow(content)
- else:
- print(content)
- def LogError(content, noTag=False):
- """
- 打印错误信息
- """
- if noTag:
- content = StringFormat.FormatStdoutString(
- str(content))
- else:
- content = StringFormat.FormatStdoutString(
- str("Error : %s" % content))
- if PrintTool:
- PrintTool.printRed(content)
- else:
- print(content)
- def LogException(content, noTag=False):
- """
- 打印错误信息
- """
- if noTag:
- content = StringFormat.FormatStdoutString(
- str(content))
- else:
- content = StringFormat.FormatStdoutString(
- str("Exception : %s" % content))
- if PrintTool:
- PrintTool.printRed(content)
- else:
- print(content)
|