xrun

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: GPL-2.0, GPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

---------------------------------------------------------------------//

GNU GENERAL PUBLIC LICENSE                       //
   Version 2, June 1991                          //
                                                 //

Copyright (C) Wells Hsu, wellshsu@outlook.com, All rights reserved. // Everyone is permitted to copy and distribute verbatim copies // of this license document, but changing it is not allowed. //

SEE LICENSE.md FOR MORE DETAILS.                   //

---------------------------------------------------------------------// Package xrun: 协程上层封装,包括异常捕捉、闪退重启、消耗时间、调用堆栈等功能.

Index

Constants

View Source
const (
	UNKONWN_SOURCE = "[?]"
)

Variables

This section is empty.

Functions

func Caller

func Caller(stack int, fullpath bool) string

获取函数调用堆栈信息

stack: 堆栈层级
fullpath: 全路径

func Caught

func Caught(exit bool, handler ...func(string, int))

捕捉goroutine的异常

exit: 是否结束进程
handler: 回调

func Elapse

func Elapse(stack int, callback ...func()) func()

计算函数执行消耗的时间,在起始处调用defer Elapse(stack)()

stack: 堆栈层级(0为当前层)

func Exec

func Exec(fun interface{}, params ...interface{})

协程封装器(panic不会引起crash,recover后该goroutine结束)

func Run

func Run(fun interface{}, params ...interface{})

协程封装器(panic不会引起crash,recover后重启该goroutine)

func StackTrace

func StackTrace(stack int, err interface{}) (string, int)

获取错误堆栈信息

stack: 堆栈层级
err: 错误信息

Types

This section is empty.

Jump to

Keyboard shortcuts

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