How do I print message to stderr in Go?

前端 未结 3 826
臣服心动
臣服心动 2021-01-04 06:50

I want to print some logs for debugging and testing, but existing logs are massive, so I want to print my own logs to stderr:

go run main.go 1>/dev/null
<         


        
3条回答
  •  旧巷少年郎
    2021-01-04 07:29

    On Linux systems, you could also use syslog(3) facilities. By default, the underlying openlog(3) does not go to stderr, but this can be changed.

    See Go package log/syslog.

提交回复
热议问题