stacko

package module
v0.0.0-...-f35fc1c Latest Latest
Warning

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

Go to latest
Published: May 9, 2016 License: MIT Imports: 5 Imported by: 1

README

stacko GoDoc

Stacko lets you generate a structured stacktrace in Go.

type Frame struct {
  FileName     string
  FunctionName string
  PackageName  string
  Path         string
  LineNumber   int
  InDomain     bool
  PreContext   []string
  PostContext  []string
  Context      string
}

Most of the fields are self explanatory. InDomain is a boolean that tells you if the frame is within the same package as the first call. The Context fields are the actual lines of code that precede and proceed the context of the frame. Please note that these context fields are only provided if the source code is present in the local file system.

API

type Stacktrace
type Stacktrace []Frame
func NewStacktrace
func NewStacktrace (skip int) (Stacktrace, error)

Returns a new Stacktrace skipping the first skip frames.

Documentation

Overview

Package stacko provides the ability to generate a structured stacktrace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextInfo

func ContextInfo(path string, lineNumber int) ([]string, int, error)

ContextInfo takes a path and a line number and returns a slice of strings that represent the line in self, the preceding and the proceding lines. It also returns the offset for the actual line in the context.

func FunctionInfo

func FunctionInfo(pc uintptr) (string, string)

FunctionInfo takes a program counter and returns the function and package name for the frame at that counter.

Types

type Frame

type Frame struct {
	FileName     string
	FunctionName string
	PackageName  string
	Path         string
	LineNumber   int
	InDomain     bool
	PreContext   []string
	PostContext  []string
	Context      string
}

The Frame type is a struct that hold a structured stacktrace frame.

type Stacktrace

type Stacktrace []Frame

The Stacktrace type is a slice of frames.

func NewStacktrace

func NewStacktrace(skip int) (Stacktrace, error)

NewStacktrace generates a complete stacktrace except for those initial skip frames that are skipped.

Jump to

Keyboard shortcuts

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