traffic-chromelogger: Index | Files | Directories

package chromelogger

import ""

Package chromemiddleware implements a Chrome Logger middleware for Traffic.

This is a Middleware for traffic ( It allows to send logs to the Chrome console if you have the Chrome Logger extension ( installed.


package main

import (

func rootHandler(w traffic.ResponseWriter, r *http.Request) {
  logger := w.GetVar("chromelogger").(*chromelogger.Logger)

    "foo": "bar",

  fmt.Fprint(w, "Hello, check your Chrome console after activating the Chrome Logger extension.\n")

func main() {
  router := traffic.New()
  router.Get("/", rootHandler)

  http.Handle("/", router)
  err := http.ListenAndServe(":7000", nil)

  if err != nil {


Package Files

data.go doc.go logger.go middleware.go responsewriter.go


const LOG_TYPE_ERROR = "error"
const LOG_TYPE_INFO = "info"
const LOG_TYPE_LOG = "log"
const LOG_TYPE_WARN = "warn"
const VERSION = "0.1.0"

type ChromeLoggerMiddleware Uses

type ChromeLoggerMiddleware struct{}

func New Uses

func New() *ChromeLoggerMiddleware

func (ChromeLoggerMiddleware) ServeHTTP Uses

func (middleware ChromeLoggerMiddleware) ServeHTTP(w traffic.ResponseWriter, r *traffic.Request, next traffic.NextMiddlewareFunc)

type Data Uses

type Data struct {
    Version string    `json:"version"`
    Columns []string  `json:"columns"`
    Rows    []*LogRow `json:"rows"`

func NewData Uses

func NewData() *Data

func (*Data) AddRow Uses

func (data *Data) AddRow(item interface{}, backtrace, logType string)

type LogData Uses

type LogData []interface{}

func (*LogData) Add Uses

func (data *LogData) Add(item interface{})

type LogRow Uses

type LogRow []interface{}

func NewLogRow Uses

func NewLogRow(logData *LogData, backtrace, logType string) *LogRow

type Logger Uses

type Logger struct {
    // contains filtered or unexported fields

func (*Logger) Error Uses

func (logger *Logger) Error(item interface{})

func (Logger) Export Uses

func (logger Logger) Export() string

func (*Logger) Info Uses

func (logger *Logger) Info(item interface{})

func (*Logger) Log Uses

func (logger *Logger) Log(item interface{})

func (*Logger) Warn Uses

func (logger *Logger) Warn(item interface{})



Package chromelogger imports 6 packages (graph) and is imported by 1 packages. Updated 2016-07-22. Refresh now. Tools for package owners.