tracker

package module
v0.0.0-...-3fb691c Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2016 License: MIT Imports: 8 Imported by: 0

README

Tracker

Build Status

This is an API used for tracking events at Reevoo.

Setup

To begin hacking on this project you need to install a few dependencies first.

Go

On the mac install go with brew install go

it is important to setup GOPATH and PATH corectly, add this to your .profile

export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH

Get the code:

go get github.com/reevoo/tracker

Dependencies

Dependencies are managed by godep.

Install godep:

go get github.com/tools/godep

To save currently-used dependencies to file Godeps:

godep save

Tests

To check everything is working properly run go test to run the unit tests.

To start the server, run go run tracker/server.go

Install & Run

 godep save
 godep go install
 $GOPATH/bin/tracker

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsoleLogger

type ConsoleLogger struct {
	// contains filtered or unexported fields
}

Logs errors to the console.

func (ConsoleLogger) LogError

func (c ConsoleLogger) LogError(err TrackerError)

Logs an error to the console.

type ErrorLogger

type ErrorLogger interface {
	LogError(err TrackerError)
}

EventLoggers keep a log of errors.

type SentryErrorLogger

type SentryErrorLogger struct {
	// contains filtered or unexported fields
}

Sentry is used to log errors.

func (SentryErrorLogger) LogError

func (s SentryErrorLogger) LogError(err TrackerError)

Logs an error to Sentry.

type Server

type Server struct {
	// contains filtered or unexported fields
}

The Server is the Tracker API.

func NewServer

func NewServer(params ServerParams) Server

Creates a new Server that does no logging.

func (Server) Run

func (server Server) Run(port string)

Start the server and handle incoming requests.

func (Server) ServeHTTP

func (server Server) ServeHTTP(resp http.ResponseWriter, req *http.Request)

type ServerParams

type ServerParams struct {
	ErrorLogger ErrorLogger
	EventLogger logger.Logger
}

Parameters passed to NewServer().

type TrackerError

type TrackerError struct {
	Name    string
	Context map[string]string
}

An unrecoverable error in Tracker.

func NewTrackerErrorFromError

func NewTrackerErrorFromError(err error, context map[string]string) TrackerError

Convert a Go error into a TrackerError.

func (TrackerError) Error

func (err TrackerError) Error() string

Returns the error description in full.

func (TrackerError) ToMap

func (err TrackerError) ToMap() map[string]string

Convert a TrackerError to a Map. Useful for JSON-based error logging due to its hierarchy.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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