cihub / seelog

Seelog is a native Go logging library that provides flexible asynchronous dispatching, filtering, and formatting.
BSD 3-Clause "New" or "Revised" License
1.64k stars 243 forks source link

line number (%Line) output is not right #150

Closed darasion closed 7 years ago

darasion commented 7 years ago

git rev-parse HEAD output is: f561c5e57575bb1e0a2167028b7339b3a8d16fb4

go version output is: go version go1.8 linux/amd64

my test code is (test.go):

package main

import (
    "github.com/cihub/seelog"
)

func main() {
    log, err := seelog.LoggerFromConfigAsString(`<seelog type="sync">
        <outputs>
            <console formatid="fmt"/>
        </outputs>
        <formats>
            <format id="fmt" format="[%RelFile:%Line] [%Func] [%Lev] %Msg%n"/>
        </formats>
        </seelog>`)
    if err != nil {
        panic(err)
    }   
    defer log.Flush()
    log.Debug("Test") // line 20
    log.Info("Test2") // line 21
}

but go run test.go output is:

[test.go:21] [main.main] [Dbg] Test
[test.go:22] [main.main] [Inf] Test2
lwithers commented 7 years ago

I find the same, but this seems to be the line number returned by Go's standard library. Seelog is not introducing the off-by-one error. Perhaps this should be reported upstream?