Giter Site home page Giter Site logo

long integer/int64 displayed as float about zerolog HOT 7 CLOSED

rs avatar rs commented on July 28, 2024
long integer/int64 displayed as float

from zerolog.

Comments (7)

rs avatar rs commented on July 28, 2024

Can you show the code that generates the second line?

from zerolog.

jwreagor avatar jwreagor commented on July 28, 2024

That particular line is being fed through zerolog via code in this PR so it's stemming from an int64 value handled by jackc/pgx.

I'll have to spend some time reproducing the issue better. When I output an int64 manually using Int64 everything works but this particular value is being converted somehow or isn't jiving with zerolog's handling of it. I was hoping someone had seen something similar in the past.

from zerolog.

rs avatar rs commented on July 28, 2024

Can you print %#v the data map please? This PR uses interface{} and not Int64. It should be mapped correctly though.

from zerolog.

jwreagor avatar jwreagor commented on July 28, 2024

Here's a proper example that reproduces the conditions using the log wrapper. I'm able to display the float that comes in by .Fields(data) as well as through .Int64() at the last call to log.

https://gist.github.com/cheapRoc/ffa69d3e5f0e5758fa8be75066ce0f42

The following is the output with Go-syntax values as you requested.

%#v map[args:[333543255570743297] time:2.678272ms rowCount:1 sql:SELECT id, name, apple_id FROM pears WHERE id = $1;]
2.678272 |INFO| Query args=[3.335432555707433e+17] module=pgx rowCount=1 sql="SELECT id, name, apple_id FROM pears WHERE id = $1;"

This definitely involves values stemming from the database driver as I'm able to log int64 values otherwise.

from zerolog.

rs avatar rs commented on July 28, 2024

The int64 is a *int64 which is not supported yet in Fields. We can add pointers support for all types.

from zerolog.

jwreagor avatar jwreagor commented on July 28, 2024

👍 I didn't put two and two together on that one.

from zerolog.

jwreagor avatar jwreagor commented on July 28, 2024

Thank you so much @rs!!

from zerolog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.