mylog

package
v0.0.46 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: Apache-2.0 Imports: 28 Imported by: 43

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RuntimePrefixesToFilter = []string{
	"runtime.",
	"testing.",
	"github.com/ddkwork/golibrary/mylog.callWithHandler",
	"github.com/ddkwork/golibrary/mylog.Call",
}

Functions

func BetterGo added in v0.0.23

func BetterGo(path string)

func Body

func Body() string

Body log包不能依赖任何包,目前的引用逻辑是这样的: stream -->safeType-->log safeType包单独提出来以便后续的更多封装调用它,比如文本编辑器等所有输入类型的控件 widget -->safeType-->log 文本编辑器设置数据借safeType支持了更多类似的设置支持 safeType -->log

func Call

func Call(f func())

func Check

func Check[T any](result T) (isEof bool)

Check error, bool, string(custom error),anything must panic for ge the safe life

func Check2 added in v0.0.6

func Check2[T any](ret T, err error) (r1 T)

func Check2Bool added in v0.0.6

func Check2Bool[T any](ret T, ok bool) (r1 T)

func Check2Ignore added in v0.0.6

func Check2Ignore[T any](ret T, err error) (r1 T)

Check2Ignore is a special version of Check2 that ignores the error and returns the first return value. This is useful for functions that return a value and an error, but you don't care about the error.

func Check3 added in v0.0.6

func Check3[T1 any, T2 any](ret1 T1, ret2 T2, err error) (r1 T1, r2 T2)

func Check3Bool added in v0.0.6

func Check3Bool[T1 any, T2 any](ret1 T1, ret2 T2, ok bool) (r1 T1, r2 T2)

func Check4 added in v0.0.6

func Check4[T1 any, T2 any, T3 any](ret1 T1, ret2 T2, ret3 T3, err error) (r1 T1, r2 T2, r3 T3)

func Check4Bool added in v0.0.6

func Check4Bool[T1 any, T2 any, T3 any](ret1 T1, ret2 T2, ret3 T3, ok bool) (r1 T1, r2 T2, r3 T3)

func Check5 added in v0.0.6

func Check5[T1 any, T2 any, T3 any, T4 any](ret1 T1, ret2 T2, ret3 T3, ret4 T4, err error) (r1 T1, r2 T2, r3 T3, r4 T4)

func Check5Bool added in v0.0.6

func Check5Bool[T1 any, T2 any, T3 any, T4 any](ret1 T1, ret2 T2, ret3 T3, ret4 T4, ok bool) (r1 T1, r2 T2, r3 T3, r4 T4)

func Check6 added in v0.0.6

func Check6[T1 any, T2 any, T3 any, T4 any, T5 any](ret1 T1, ret2 T2, ret3 T3, ret4 T4, ret5 T5, err error) (r1 T1, r2 T2, r3 T3, r4 T4, r5 T5)

func Check6Bool added in v0.0.6

func Check6Bool[T1 any, T2 any, T3 any, T4 any, T5 any](ret1 T1, ret2 T2, ret3 T3, ret4 T4, ret5 T5, ok bool) (r1 T1, r2 T2, r3 T3, r4 T4, r5 T5)

func Check7 added in v0.0.7

func Check7[T1 any, T2 any, T3 any, T4 any, T5 any, T6 any](ret1 T1, ret2 T2, ret3 T3, ret4 T4, ret5 T5, ret6 T6, err error) (r1 T1, r2 T2, r3 T3, r4 T4, r5 T5, r6 T6)

func Check7Bool added in v0.0.7

func Check7Bool[T1 any, T2 any, T3 any, T4 any, T5 any, T6 any](ret1 T1, ret2 T2, ret3 T3, ret4 T4, ret5 T5, ret6 T6, ok bool) (r1 T1, r2 T2, r3 T3, r4 T4, r5 T5, r6 T6)

func CheckIgnore added in v0.0.8

func CheckIgnore(err any)

func CheckNil

func CheckNil(ptr any)

CheckNil interface{} or object pointer or other value, must not nil or zero value

func CreatDirectory added in v0.0.23

func CreatDirectory(dir string) bool

func Diff

func Diff(oldName string, old []byte, newName string, new []byte) []byte

Diff returns an anchored diff of the two texts old and new in the “unified diff” format. If old and new are identical, Diff returns a nil slice (no output).

Unix diff implementations typically look for a diff with the smallest number of lines inserted and removed, which can in the worst case take time quadratic in the number of lines in the texts. As a result, many implementations either can be made to run for a long time or cut off the search after a predetermined amount of work.

In contrast, this implementation looks for a diff with the smallest number of “unique” lines inserted and removed, where unique means a line that appears just once in both old and new. We call this an “anchored diff” because the unique lines anchor the chosen matching regions. An anchored diff is usually clearer than a standard diff, because the algorithm does not try to reuse unrelated blank lines or closing braces. The algorithm also guarantees to run in O(n log n) time instead of the standard O(n²) time.

Some systems call this approach a “patience diff,” named for the “patience sorting” algorithm, itself named for a solitaire card game. We avoid that name for two reasons. First, the name has been used for a few different variants of the algorithm, so it is imprecise. Second, the name is frequently interpreted as meaning that you have to wait longer (to be patient) for the diff, meaning that it is a slower algorithm, when in fact the algorithm is faster than the standard one.

func DumpRequest

func DumpRequest(req *http.Request, body bool) string

func DumpResponse

func DumpResponse(resp *http.Response, body bool) string

func FixUncPath added in v0.0.23

func FixUncPath(path string) string

func GetLastReturnType added in v0.0.31

func GetLastReturnType(assignStmt *ast.AssignStmt) (lastReturnType string, b bool)

func Hex

func Hex[T constraints.Integer | []byte | *bytes.Buffer](title string, msg T) string

func HexDump

func HexDump(title string, b []byte)

func HexInteger

func HexInteger[T constraints.Integer](msg T) string

func Info

func Info(title string, msg ...any)

func IsAndroid

func IsAndroid() bool

func IsLinux

func IsLinux() bool

func IsWindows

func IsWindows() bool

func Json

func Json(title string, msg ...any)

func MarshalJson

func MarshalJson(title string, msg any)

func Message

func Message() string

func Reason

func Reason() (reason string)

func Request

func Request(Request *http.Request, body bool)

func Response

func Response(Response *http.Response, body bool)

func SetDebug

func SetDebug(debug bool)

func Struct

func Struct(msg any)

func Success

func Success(title string, msg ...any)

func Trace

func Trace(title string, msg ...any)

func TruncateLogFile

func TruncateLogFile()

func Warning

func Warning(title string, msg ...any)

func WriteGoFileWithDiff added in v0.0.23

func WriteGoFileWithDiff[T []byte](path string, data T)

Types

This section is empty.

Directories

Path Synopsis
close command
merge command
saf command

Jump to

Keyboard shortcuts

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