Comments (3)
I suspect we'd just need something like this, but for wasm: https://github.com/sirupsen/logrus/blob/master/terminal_check_js.go
from logrus.
Aaaaand you're already on it. 7165f5e
$ go get -u github.com/sirupsen/logrus@master
go: downloading github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af
$ GOOS=wasip1 GOARCH=wasm go1.21rc2 build
# works
Thank you! 😄
from logrus.
Update 2
Ok so it seems the PR #1388 is not part of the 1.9.3 release version
Changed the line in go.mod to require github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af
and now it works
$ make build-wasm
CGO_ENABLED=0 GOOS=wasip1 GOARCH=wasm go build -o bin/test.wasm .
# CGO_ENABLED=0 tinygo build -o bin/test.wasm -target=wasi .
$ echo $?
0
Update
With go 1.21
$ go version
go version go1.21.0 darwin/amd64
$ GOOS=wasip1 GOARCH=wasm go build -o main.wasm main.go
# github.com/sirupsen/logrus
/Users/user/go/pkg/mod/github.com/sirupsen/[email protected]/terminal_check_notappengine.go:13:10: undefined: isTerminal
The /Users/user/go/pkg/mod/github.com/sirupsen/[email protected]/terminal_check_notappengine.go file
// +build !appengine,!js,!windows,!nacl,!plan9
package logrus
import (
"io"
"os"
)
func checkIfTerminal(w io.Writer) bool {
switch v := w.(type) {
case *os.File:
return isTerminal(int(v.Fd()))
default:
return false
}
}
Original
Hi, I am running into this issue when compiling with TinyGo for WASI target
$ go version
go version go1.20.7 darwin/amd64
$ tinygo version
tinygo version 0.28.1 darwin/amd64 (using go version go1.20.7 and LLVM version 15.0.0)
$ tinygo build -o main.wasm -target=wasi main.go
tinygo:wasm-ld: error: /var/folders/dt/y3srs7vs6pz9bqwrbjwt38pc0000gp/T/tinygo4119433949/main.o: undefined symbol: golang.org/x/sys/unix.Syscall
failed to run tool: wasm-ld
error: failed to link /var/folders/dt/y3srs7vs6pz9bqwrbjwt38pc0000gp/T/tinygo4119433949/main: exit status 1
The main.go file
package main
import "github.com/sirupsen/logrus"
func main() {
logrus.Infof("start")
logrus.Infof("done")
}
The go.mod file
module foo.com/b
go 1.20
require github.com/sirupsen/logrus v1.9.3
require golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
The go.sum file
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
from logrus.
Related Issues (20)
- Skip debug level log from console output but should present in log file HOT 2
- CVE reported on logrus HOT 2
- How to Access IsDebugEnabled in FieldLogger? HOT 3
- Data race in hooks.test package HOT 3
- virter vm cp not working HOT 2
- Info requested: How to buffer messages and release at the end HOT 2
- Vulnerability of dependency "gopkg.in/yaml.v3" HOT 2
- Logrus potential DOS - Please open a CVE for issue #1370 to encourage users to patch HOT 3
- Feature: Add slog compatibility layer HOT 5
- logrus+lumberjackrus, After the old log is deleted, the hard drive will not be released, HOT 2
- Vulnerability: gopkg.in/yaml.v3 CVE-2022-28948 HOT 2
- Bazel compilation failling HOT 2
- Question: Any way to view the value of a field from a logrus.FieldLogger? HOT 2
- How to apply colours for a custom log format? HOT 2
- How to safely change Logger.Out on the fly? HOT 2
- How should I position my problem? HOT 2
- Cut a new release with wasip1 support? HOT 4
- github.com/interactive-solutions/go-logrus-elasticsearch cannot find HOT 2
- Bump version of stretchr/testify? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logrus.