gpt4 book ai didi

go - 获取 syslog.Writer undefined

转载 作者:IT王子 更新时间:2023-10-29 00:40:12 26 4
gpt4 key购买 nike

我已经创建了如下自定义类型。

import (
"encoding/json"
"log"
"log/syslog"
"strconv"
"time"
)

type MyLogger struct {
w *syslog.Writer
LogName string
}

我收到错误 syslog.writer undefined。甚至我在 golang play ground 中也尝试过同样的操作,但它给出了同样的错误。

https://play.golang.org/p/2unuwHBoBE

最佳答案

根据 https://blog.golang.org/playground ,

To isolate user programs from Google's infrastructure, the back end runs them under Native Client (or "NaCl")

并且来自 https://golang.org/pkg/log/syslog/

This package is not implemented on Windows. As the syslog package is frozen, Windows users are encouraged to use a package outside of the standard library. For background, see https://golang.org/issue/1108.

This package is not implemented on Plan 9.

This package is not implemented on NaCl (Native Client).

您使用的是 Windows,而 Go Playground 使用的是 NaCl,这两个系统日志都没有实现。

关于go - 获取 syslog.Writer undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42083059/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com