LogTool

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 7 Imported by: 16

README

log-tool

Packet Log-Tool implements a way to use Log more easily

Install

go get -u -v github.com/adimax2953/log-tool
package main

import (
    "github.com/adimax2953/log-tool"
)


func main() {
    LogTool.LogDebug("testLogDebug")
	LogTool.LogDivider("testLogDivider")
	LogTool.LogInfo("testLogInfo")
	LogTool.LogError("testLogError")
	LogTool.LogWarning("testLogWarning")
	LogTool.LogReturnLine()
	LogTool.LogSystem("testLogSystem")
	LogTool.LogDevelop("testLogDevelop")
	LogTool.LogConfig("testLogConfig")
	LogTool.LogCron("testLogCron")
	LogTool.LogFatal("testLogFatal")
}

TODO

  1. Add test cases using "testify".
  2. Add log test method.
  3. Improve or remove useless code.
  4. Check code formatting.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogBase

func LogBase(lt LogType, message string, datas ...interface{})

ex: LogTool.LogError("", err)LogType.Error, "Error", err)

func LogBaseN

func LogBaseN(lt LogType, message string, datas ...interface{})

ex: LogTool.LogErrorN("", err)LogType.Error, "Error", err)

func LogBasef

func LogBasef(lt LogType, message string, format string, datas ...any)

ex: LogTool.LogError("", err)LogType.Error, "Error", err)

func LogConfig

func LogConfig(message string, datas ...interface{})

func LogConfigN

func LogConfigN(message string, datas ...interface{})

func LogConfigf

func LogConfigf(message string, format string, datas ...any)

func LogConnect

func LogConnect(message string, datas ...interface{})

func LogConnectN

func LogConnectN(message string, datas ...interface{})

func LogConnectf

func LogConnectf(message string, format string, datas ...any)

func LogCron

func LogCron(message string, datas ...interface{})

func LogCronN

func LogCronN(message string, datas ...interface{})

func LogCronf

func LogCronf(message string, format string, datas ...any)

func LogDebug

func LogDebug(message string, datas ...interface{})

func LogDebugN

func LogDebugN(message string, datas ...interface{})

func LogDebugf

func LogDebugf(message string, format string, datas ...any)

func LogDevelop

func LogDevelop(message string, datas ...interface{})

func LogDevelopN

func LogDevelopN(message string, datas ...interface{})

func LogDevelopf

func LogDevelopf(message string, format string, datas ...any)

func LogDivider

func LogDivider(message string)

func LogError

func LogError(message string, datas ...interface{})

func LogErrorN

func LogErrorN(message string, datas ...interface{})

func LogErrorf

func LogErrorf(message string, format string, datas ...any)

func LogFatal

func LogFatal(message string, datas ...interface{})

func LogFatalN

func LogFatalN(message string, datas ...interface{})

func LogFatalf

func LogFatalf(message string, format string, datas ...any)

func LogInfo

func LogInfo(message string, datas ...interface{})

func LogInfoN

func LogInfoN(message string, datas ...interface{})

func LogInfof

func LogInfof(message string, format string, datas ...any)

func LogReturnLine

func LogReturnLine()

func LogSystem

func LogSystem(message string, datas ...interface{})

func LogSystemN

func LogSystemN(message string, datas ...interface{})

func LogSystemf

func LogSystemf(message string, format string, datas ...any)

func LogWarning

func LogWarning(message string, datas ...interface{})

func LogWarningN

func LogWarningN(message string, datas ...interface{})

func LogWarningf

func LogWarningf(message string, format string, datas ...any)

func SetOutput

func SetOutput(w io.Writer)

Types

type LogType added in v0.0.5

type LogType int
const (
	ReturnLine LogType = iota // 換行
	Divider                   // 分隔線
	Fatal                     // 嚴重錯誤, 會關閉程式
	Error                     // 錯誤, 可能造成系統 Crash
	Warning                   // 警示, 可能會造成資料異常
	Info                      // 顯示資訊
	Debug                     // 除錯使用
	Develop                   // 開發環境才紀錄
	System                    // 系統呼叫
	Cron                      // 定時排程
	Config                    // config 資訊
	Connect                   // 發送其他主機
)

func (LogType) String added in v0.0.5

func (logType LogType) String() string

Jump to

Keyboard shortcuts

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