Documentation
¶
Index ¶
- Variables
- func Body() string
- func Call(f func())
- func Check(args ...any)
- func Check2[T any](ret T, err error) (r1 T)
- func Check2Bool[T any](ret T, ok bool) (r1 T)
- func Check2Ignore[T any](ret T, err error) (r1 T)
- func Check3[T1 any, T2 any](ret1 T1, ret2 T2, err error) (r1 T1, r2 T2)
- func Check3Bool[T1 any, T2 any](ret1 T1, ret2 T2, ok bool) (r1 T1, r2 T2)
- func Check4[T1 any, T2 any, T3 any](ret1 T1, ret2 T2, ret3 T3, err error) (r1 T1, r2 T2, r3 T3)
- func Check4Bool[T1 any, T2 any, T3 any](ret1 T1, ret2 T2, ret3 T3, ok bool) (r1 T1, r2 T2, r3 T3)
- 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[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[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[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[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[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(err any)
- func CheckNil(ptr any)
- func Diff(oldName string, old []byte, newName string, new []byte) []byte
- func DumpRequest(req *http.Request, body bool) string
- func DumpResponse(resp *http.Response, body bool) string
- func Hex[T constraints.Integer | []byte | *bytes.Buffer](title string, msg T) string
- func HexDump(title string, b []byte)
- func HexInteger[T constraints.Integer](msg T) string
- func Info(title string, msg ...any)
- func IsAndroid() bool
- func IsLinux() bool
- func IsWindows() bool
- func Json(title string, msg ...any)
- func MarshalJson(title string, msg any)
- func Message() string
- func Reason() (reason string)
- func Request(Request *http.Request, body bool)
- func Response(Response *http.Response, body bool)
- func SetDebug(debug bool)
- func Struct(msg any)
- func Success(title string, msg ...any)
- func Trace(title string, msg ...any)
- func TruncateLogFile()
- func Warning(title string, msg ...any)
Constants ¶
This section is empty.
Variables ¶
var RuntimePrefixesToFilter = []string{
"runtime.",
"testing.",
"github.com/ddkwork/golibrary/mylog.callWithHandler",
"github.com/ddkwork/golibrary/mylog.Call",
}
Functions ¶
func Body ¶
func Body() string
Body log包不能依赖任何包,目前的引用逻辑是这样的: stream -->safeType-->log safeType包单独提出来以便后续的更多封装调用它,比如文本编辑器等所有输入类型的控件 widget -->safeType-->log 文本编辑器设置数据借safeType支持了更多类似的设置支持 safeType -->log
func Check ¶
func Check(args ...any)
Check The immediate effect is to streamline any code that requires error and bool returns for detection and braces, and to enhance code readability. In short, any function or method no longer needs to return error and bool, and consequently the brackets are no longer needed to determine whether err or bool return or panic operations.
func Check2Bool ¶ added in v0.0.6
func Check2Ignore ¶ added in v0.0.6
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 Check3Bool ¶ added in v0.0.6
func Check4Bool ¶ added in v0.0.6
func Check5Bool ¶ added in v0.0.6
func Check6Bool ¶ added in v0.0.6
func Check7Bool ¶ added in v0.0.7
func CheckIgnore ¶ added in v0.0.8
func CheckIgnore(err any)
func Diff ¶
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 HexInteger ¶
func HexInteger[T constraints.Integer](msg T) string
func MarshalJson ¶
func TruncateLogFile ¶
func TruncateLogFile()
Types ¶
This section is empty.