all repos — homestead @ 5578c5601faf87ebedcc6d002d873141cab82c6a

Code for my website

internal/stats/nullcounter/nullcounter.go (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package nullcounter

import (
	"net/http"

	"go.alanpearce.eu/x/log"
)

type Options struct {
	Logger *log.Logger
}

type NullCounter struct {
	log *log.Logger
}

func New(opts *Options) *NullCounter {
	return &NullCounter{
		log: opts.Logger,
	}
}

func (nc *NullCounter) Count(r *http.Request, title string) {
	nc.log.Debug("counting request", "path", r.URL.Path, "title", title)
}