Skip to content

Instantly share code, notes, and snippets.

View gerardcl's full-sized avatar
🏠
Working from home

gerardcl gerardcl

🏠
Working from home
View GitHub Profile
@oliverdaff
oliverdaff / tracing-instrument-macro.md
Created January 4, 2024 01:13
Tutorial on Using the tracing::instrument Macro in Rust

Tutorial on Using the tracing::instrument Macro in Rust

Introduction

This document provides a comprehensive guide on using the tracing::instrument macro in Rust. It covers the basics of the tracing crate, the purpose and functioning of the instrument macro, and best practices for its effective use in software development.

What is the tracing::instrument Macro?

  • Overview: The tracing crate is a collection of Rust libraries for application-level tracing and asynchronous diagnostics. It provides a framework for collecting structured, event-based diagnostic information. The instrument macro, specifically, is a part of this crate. It automatically attaches context-specific information to logs, such as function arguments and return values, making it easier to track the flow and performance of the code.

  • Purpose: The primary purpose of the tracing::instrument macro is to aid in diagnostics and performance analysis. By annotating functions with this macro, developers can automatic

@fedragon
fedragon / sdkman_with_fish
Last active November 20, 2024 22:46
How to use SDKMan! with Fish shell
# Install bass (https://github.com/edc/bass) to be able to use bash utilities in Fish
fisher add edc/bass
touch ~/.config/fish/functions/sdk.fish
# paste content in ~/.config/fish/functions/sdk.fish, then save
function sdk
bass source ~/.sdkman/bin/sdkman-init.sh ';' sdk $argv
end