Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use logger util for sphinx-tribes/auth #2265

Closed
Tracked by #2168
kevkevinpal opened this issue Dec 22, 2024 · 6 comments · Fixed by #2279
Closed
Tracked by #2168

Use logger util for sphinx-tribes/auth #2265

kevkevinpal opened this issue Dec 22, 2024 · 6 comments · Fixed by #2279
Assignees

Comments

@kevkevinpal
Copy link
Contributor

kevkevinpal commented Dec 22, 2024

Description

We want to replace in sphinx-tribes/auth where we use fmt.Print{f,ln}

 grep -nri "fmt\.Print" ./auth/
./auth/auth.go:44:                      fmt.Println("[auth] no token")
./auth/auth.go:55:                              fmt.Println("Failed to parse JWT")
./auth/auth.go:61:                              fmt.Println("Token has expired")
./auth/auth.go:72:                              fmt.Println("[auth] no pubkey || err != nil")
./auth/auth.go:74:                                      fmt.Println(err)
./auth/auth.go:101:                     fmt.Println("[auth] no token")
./auth/auth.go:111:                             fmt.Println("Failed to parse JWT")
./auth/auth.go:117:                             fmt.Println("Token has expired")
./auth/auth.go:124:                             fmt.Println("Not a super admin")
./auth/auth.go:135:                             fmt.Println("[auth] no pubkey || err != nil")
./auth/auth.go:137:                                     fmt.Println(err)
./auth/auth.go:144:                             fmt.Println("Not a super admin : auth")
./auth/auth.go:167:                     fmt.Println("[auth] no token")
./auth/auth.go:173:                     fmt.Println("Not a super admin : auth")
./auth/auth.go:189:                     fmt.Println("Endpoint is for testing only : test endpoint")
./auth/auth.go:229:                     fmt.Println("TOO LATE!")
./auth/auth.go:234:                     fmt.Println("TOO EARLY!")
./auth/auth.go:266:             fmt.Printf("ERR: %+v\n", err)
@AhsanFarooqDev
Copy link
Contributor

@kevkevinpal can I help?

@saithsab877
Copy link
Contributor

@kevkevinpal assign me

@MahtabBukhari
Copy link
Contributor

@kevkevinpal please assign me

@saithsab877
Copy link
Contributor

Hi @kevkevinpal,

While implementing structured logging in the auth package, we've encountered an import cycle issue. The auth package cannot import utils because utils already imports auth, creating a circular dependency.

image

@saithsab877
Copy link
Contributor

saithsab877 commented Dec 23, 2024

@kevkevinpal,

We're facing an import cycle between auth and utils packages. Here's the proposed solution:

1- Create a new logger package
2- Move logging code from utils/logger.go to logger/logger.go
3- Update imports in auth , utils and other all folders to use the new logger package.

@kevkevinpal
Copy link
Contributor Author

@kevkevinpal,

We're facing an import cycle between auth and utils packages. Here's the proposed solution:

1- Create a new logger package 2- Move logging code from utils/logger.go to logger/logger.go 3- Update imports in auth , utils and other all folders to use the new logger package.

I think this proposed solution makes sense if you want to go forward with that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants