Code Monkey home page Code Monkey logo

Comments (3)

alessandroargentieri avatar alessandroargentieri commented on August 30, 2024

@ilmanzo do you have any suggestions on this?
Do you think is possible to take advantage of other libs or the fact that we don't know the struct of the generic object to be logged prevents us from using a reflectionless library?

from noodlog.

ilmanzo avatar ilmanzo commented on August 30, 2024

I'd suggest first to run profile ( https://blog.golang.org/pprof ) with a sample program that logs many different data structures at different loglevels, to identify the bottlenecks. When I'll find some spare time, I can prepare some benchmarks.

Also take a look at the approach from https://github.com/rs/zerolog (logger developed by Netflix Director of Engineering), because allocation impacts memory footprint and performance (due to pressure on Garbage Collector)

Maybe the user could "tag" the struct fields to decide when to log a field or not, in order to save time and avoid sensitive data leak ?

from noodlog.

alessandroargentieri avatar alessandroargentieri commented on August 30, 2024

@ilmanzo What is meant by "avoiding allocation"? Do they avoid creating instances of structs in memory? The idea of the tag is very good but only if you know the struct you're going to log. I wanted to cover also the case I make an HTTP request, I get the response and without unmarshalling, I log the response directly, obscurating sensitive data if any. I thought if this is a heavy operation, I could extract the obscuration method outside, so it could be used only if it is explicit. Many thanks for all your precious suggestions.

from noodlog.

Related Issues (18)

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.