Giter Club home page Giter Club logo

Comments (5)

gatoWololo avatar gatoWololo commented on July 28, 2024 1

Sure! In PR #13 I have:

debug!("execve(\"{:?}\", {:?})", path_name, args);
trace!("envp={:?}", envp);

That is, when running on debug we print the path and args to execve, but only when running on trace do we print the environment variables (which might still be too verbose, even for trace).

In general I treat info as the default logging mode, which prints useful information for what is happening but not too verbose. debug is even more information but still relates to logical events hapenning, trace I like trace being verbose enough to understand what function is currently executing and sometimes even which code branch was taken. Lmk if that makes sense!

from processcache.

gatoWololo avatar gatoWololo commented on July 28, 2024

The standard verbosity levels for Rust are as follow. Here is my recommended convention for logging output:

  • Error: We usually panic on error as there isn't much need for us to recover from fatal errors so we probably won't use error.
  • Warn: This is similar to error but it might be useful to warn in some situations. We should use warn for reporting issues to the user.
  • Info: Info should be reserved for always relevant information. Some examples include: encountered an exec, new process spawned, ptrace event intercepted. Specific system call being handled.
  • Debug: This is for low priority, but sometimes nice to have extra information.
    -Trace: Trace is extremely verbose and often tracks all function calls and events one might want to know about when debugging an issue.

It may seem that trace is like drinking from a fire hose, thankfully Rust and the Tracing crate allows us to filter events several ways, making it far easier to track only events we care about. This also needs to be considered when adding logging for the project. More on this to come...

from processcache.

krs85 avatar krs85 commented on July 28, 2024

Thank you for listing these, I actually don't think I really knew about those! But I will definitely keep these in mind. I think the one I don't see the difference between is debug and trace. I think I usually them interchangeably, and I actually don't think I've really used trace. Could you give me an example of when to use one over the other?

from processcache.

krs85 avatar krs85 commented on July 28, 2024

Yes that totally makes sense. Thank you for doing this!

from processcache.

krs85 avatar krs85 commented on July 28, 2024

Done by @gatoWololo in #13

from processcache.

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.