Log

package
v0.0.0-...-3e87f45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2022 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

* @Author: NyanCatda * @Date: 2022-03-21 19:51:14 * @LastEditTime: 2022-06-17 23:41:24 * @LastEditors: NyanCatda * @Description: 终端输出颜色 * @FilePath: \Momizi\Tools\Log\Color.go

Index

Constants

View Source
const (
	TextBlack = iota + 30
	TextRed
	TextGreen
	TextYellow
	TextBlue
	TextMagenta
	TextCyan
	TextWhite
)
View Source
const (
	DEBUG = iota + 0
	INFO
	WARNING
	ERROR
	OFF
)

Variables

View Source
var (
	LogPath    = Controller.LogPath + "/"
	LogLevel   = DEBUG
	ColorPrint bool
)

Functions

func Black

func Black(msg string) string

func Blue

func Blue(msg string) string

func Cyan

func Cyan(msg string) string

func DeBug

func DeBug(Source string, Text ...any)

*

  • @description: 打印DeBug错误
  • @param {string} Source 日志来源
  • @param {...any} Text 日志内容
  • @return {*}

func DelColor

func DelColor(msg string) string

*

  • @description: 去除文字颜色
  • @param {string} msg 需要去除颜色的文字
  • @return {string} 去除颜色后的文字

func Error

func Error(Source string, Error error)

*

  • @description: 打印错误
  • @param {string} Source 日志来源
  • @param {error} Error 错误信息
  • @return {*}

func Green

func Green(msg string) string

func Info

func Info(Source string, Text ...any)

*

  • @description: 打印信息
  • @param {string} Source 日志来源
  • @param {...any} Text 日志内容
  • @return {*}

func LogFile

func LogFile() (*os.File, error)

*

  • @description: 读写Log文件,按天分割日志
  • @param {*}
  • @return {*os.File}
  • @return {error}

func Magenta

func Magenta(msg string) string

func Print

func Print(Source string, Level int, Text ...any) error

*

  • @description: 标准日志打印
  • @param {string} Source 日志来源
  • @param {string} Level 日志等级 INFO/WARNING/ERROR/DEBUG
  • @param {...any} Text 日志内容
  • @return {*}

func ReceivedMessage

func ReceivedMessage(ChatSoftware string, ChatType string, ChatID string, UserName string, SenderID string, Content string)

*

  • @description: 打印接收到的消息
  • @param {string} ChatSoftware 聊天软件, QQ/Telegram/Line
  • @param {string} ChatType 聊天类型, User/Group/Other
  • @param {string} ChatID 聊天ID
  • @param {string} UserName 用户名
  • @param {string} SenderID 发送者ID
  • @param {string} Content 消息内容
  • @return {*}

func Red

func Red(msg string) string

func SendMessage

func SendMessage(ChatSoftware string, ChatType string, ChatID string, Content string)

*

  • @description: 打印发送的消息
  • @param {string} ChatSoftware 聊天软件, QQ/Telegram/Line
  • @param {string} ChatType 聊天类型, User/Group/Other
  • @param {string} ChatID 聊天ID
  • @param {string} Content 消息内容
  • @return {*}

func SetColor

func SetColor(msg string, conf, bg, text int) string

func Warning

func Warning(Source string, Text ...any)

*

  • @description: 打印警告
  • @param {string} Source 日志来源
  • @param {...any} Text 日志内容
  • @return {*}

func White

func White(msg string) string

func Yellow

func Yellow(msg string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL