Giter Site home page Giter Site logo

Binary format support about zerolog HOT 6 CLOSED

toravir avatar toravir commented on July 28, 2024
Binary format support

from zerolog.

Comments (6)

rs avatar rs commented on July 28, 2024

Might be interesting.

from zerolog.

toravir avatar toravir commented on July 28, 2024

@rs - just keeping you posted.. am more than half-way done with binary support - you could see the changes here: https://github.com/toravir/zerolog/commits/binary

I could use review comments...

from zerolog.

rs avatar rs commented on July 28, 2024

I have a few questions:

  • Why CBOR instead of BSON? (This is a candid question, I don't know much about CBOR)
  • How do you plan to plug the cbor package into event/context?
  • Why did you refactor the json package? I'm not against it but I don't think it belongs to this PR (and it will make the review harder).
  • Is cbor package custom made for this PR or copied/adapted from another project? If the later, we need to put copyright info.
  • The global binary flag can be confusing. It gives the impression that it will turn all logging into binary, even existing instances. What it really does is changing the default encoding. Its name (and doc) should reflect that.

I did not review the cbor package implementation yet. I need some time to read the spec etc. I will save that for when you are ready for the PR.

Good job!

from zerolog.

toravir avatar toravir commented on July 28, 2024

@rs

Why CBOR instead of BSON? (This is a candid question, I don't know much about CBOR)

CBOR is more flexible with multiple different data types that BSON - bson is specific to how mongodb sends json objects across the wire. Plus CBOR is a RFC Standard. I had posted on JSON forum ([email protected]) and got a recommendation to use CBOR. FYI - CBOR RFC: https://tools.ietf.org/html/rfc7049

How do you plan to plug the cbor package into event/context?

It is not as clean plug as i would have liked - but i have pushed one approach. Am open to other ways of doing this. The first cut is in this commit: toravir@a6948d4#diff-9fb85d1ee9f1b0a59804bec41e1491fe

Why did you refactor the json package? I'm not against it but I don't think it belongs to this PR (and it will make the review harder).

Sure i can push that change as a different PR. The idea is to isolate all JSON specific writes to json package - so that common code does not have any JSON specific writes - only few minor changes.

Is cbor package custom made for this PR or copied/adapted from another project? If the later, we need to put copyright info.

I wrote this code from ground up. Other implementations i had seen were JSON to CBOR - could not be re-used for zerolog's purpose.

The global binary flag can be confusing. It gives the impression that it will turn all logging into binary, even existing instances. What it really does is changing the default encoding. Its name (and doc) should reflect that.

Sure will rename it to imply the correct meaning.

Thx

from zerolog.

rs avatar rs commented on July 28, 2024

@toravir any news on that PR?

from zerolog.

toravir avatar toravir commented on July 28, 2024

@rs - will submit PR shortly. Has two items in the todo - will commit within a week or two:

  1. Changes to documentation (README.md)
  2. When doing reflection, skip using JSON and write a binary based encoder

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.