我如何在不使用log
的情况下向Stderr发送消息?
A comment in this SO post显示了如何使用log
:log.Println("Message")
执行此操作,但是如果我不需要时间戳怎么办?
以下是好消息吗?
os.Stderr.WriteString("Message")
个
我如何在不使用log
的情况下向Stderr发送消息?
A comment in this SO post显示了如何使用log
:log.Println("Message")
执行此操作,但是如果我不需要时间戳怎么办?
以下是好消息吗?
os.Stderr.WriteString("Message")
个
Go内置函数print
和println
打印到stderr.所以,如果你只是想输出一些文本到stderr,你可以这样做
package main
func main() {
println("Hello stderr!")
}