Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
n0rad committed Nov 12, 2015
1 parent 34eae88 commit 391f15a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions log/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (f *BlaFormatter) Format(entry *log.Entry) ([]byte, error) {

// isColored := isTerminal && (runtime.GOOS != "windows")

paths := strings.SplitN(file, "/", pathSkip + 1)
paths := strings.SplitN(file, "/", pathSkip+1)

b := &bytes.Buffer{}
fmt.Fprintf(b, "%s %s%-5s%s %s%30s:%-3d%s %s%-44s%s",
Expand Down Expand Up @@ -81,15 +81,15 @@ func (f *BlaFormatter) reduceFilePath(path string, max int) string {
split := strings.Split(path, "/")
splitlen := len(split)
reducedSize := len(path)
var buffer bytes.Buffer;
var buffer bytes.Buffer
for i, e := range split {
if (reducedSize > max && i + 1 < splitlen) {
if reducedSize > max && i+1 < splitlen {
buffer.WriteByte(e[0])
reducedSize -= len(e) - 1
} else {
buffer.WriteString(e)
}
if (i + 1 < splitlen) {
if i+1 < splitlen {
buffer.WriteByte('/')
}
}
Expand All @@ -99,7 +99,7 @@ func (f *BlaFormatter) reduceFilePath(path string, max int) string {
func (f *BlaFormatter) findFileAndLine() (string, int) {
var file string
var line int
for i := 5;; i++ {
for i := 5; ; i++ {
_, file, line, _ = runtime.Caller(i)
if !strings.Contains(file, "Sirupsen/logrus") {
break
Expand Down Expand Up @@ -176,9 +176,9 @@ func (f *BlaFormatter) levelColor(level log.Level) string {
func needsQuoting(text string) bool {
for _, ch := range text {
if !((ch >= 'a' && ch <= 'z') ||
(ch >= 'A' && ch <= 'Z') ||
(ch >= '0' && ch <= '9') ||
ch == '-' || ch == '.') {
(ch >= 'A' && ch <= 'Z') ||
(ch >= '0' && ch <= '9') ||
ch == '-' || ch == '.') {
return false
}
}
Expand Down

0 comments on commit 391f15a

Please sign in to comment.