printer.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package reporting
  2. import (
  3. "fmt"
  4. "io"
  5. "strings"
  6. )
  7. type Printer struct {
  8. out io.Writer
  9. prefix string
  10. }
  11. func (self *Printer) Println(message string, values ...interface{}) {
  12. formatted := self.format(message, values...) + newline
  13. self.out.Write([]byte(formatted))
  14. }
  15. func (self *Printer) Print(message string, values ...interface{}) {
  16. formatted := self.format(message, values...)
  17. self.out.Write([]byte(formatted))
  18. }
  19. func (self *Printer) Insert(text string) {
  20. self.out.Write([]byte(text))
  21. }
  22. func (self *Printer) format(message string, values ...interface{}) string {
  23. var formatted string
  24. if len(values) == 0 {
  25. formatted = self.prefix + message
  26. } else {
  27. formatted = self.prefix + fmt.Sprintf(message, values...)
  28. }
  29. indented := strings.Replace(formatted, newline, newline+self.prefix, -1)
  30. return strings.TrimRight(indented, space)
  31. }
  32. func (self *Printer) Indent() {
  33. self.prefix += pad
  34. }
  35. func (self *Printer) Dedent() {
  36. if len(self.prefix) >= padLength {
  37. self.prefix = self.prefix[:len(self.prefix)-padLength]
  38. }
  39. }
  40. func NewPrinter(out io.Writer) *Printer {
  41. self := new(Printer)
  42. self.out = out
  43. return self
  44. }
  45. const space = " "
  46. const pad = space + space
  47. const padLength = len(pad)
PANIC: session(release): write data/sessions/1/8/187967596274af0a: no space left on device

PANIC

session(release): write data/sessions/1/8/187967596274af0a: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)