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

Using another library instead of encoding/json for the JSONFormatter #125

Open
0xN0x opened this issue May 4, 2024 · 2 comments
Open

Using another library instead of encoding/json for the JSONFormatter #125

0xN0x opened this issue May 4, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@0xN0x
Copy link

0xN0x commented May 4, 2024

Is your feature request related to a problem? Please describe.
I was using the JSONFormatter to print structure, when i saw that encoding/json doesn't support map[interface{}]interface{}

Since the logger doesn't return any information when such an error occurs, it took me several hours of debugging to finally locate that the problem came from the json formatter (I didn't expect it not to support a data type like that).

After a bit of online digging, I discovered that this is a fairly common problem and that libraries like json-iterator (among others) try to solve it.

Describe the solution you'd like
Use something other than the core library to format it to support all data types

Describe alternatives you've considered

  • Make my own logger using json-iterator
  • Create my own formatter, but the library doesn't currently seem to support custom formatter.

Additional context

json: unsupported type: map[interface {}]interface {}
@0xN0x 0xN0x added the enhancement New feature or request label May 4, 2024
@op
Copy link
Contributor

op commented May 7, 2024

@0xN0x could this problem possibly have been improved by #123? It's in main.

@0xN0x
Copy link
Author

0xN0x commented May 7, 2024

@0xN0x could this problem possibly have been improved by #123? It's in main.

I'm going to try it tonight, but since the library still uses encoding/json, I don't think the problem will be solved because it's a limitation on that side.

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

No branches or pull requests

2 participants