tools

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2025 License: MIT Imports: 3 Imported by: 0

README

tools

set of utility functions

  • PrettyByteSize - returns a human readable string of int bytes

    ${999 => 999 \color{green}\space B}$
    ${2048 => 2.0 \color{green}\space KiB}$
    ${1058575 => 1.01 \color{green}\space MiB}$

packages

logging

slog helpers

  • create logger with default, disard, text or json handler
  • options to set output, loglevel, timeformat, include source, truncate source
config

configuration helper

  • reads yaml config file from XDG_CONFIG_HOME i.e. ~/.config/progname/config into user supplied struct
  • value is cached for quicker subsequent lookups

Documentation

Overview

Package tools implements utility routines

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrettyByteSize

func PrettyByteSize(b int) string

PrettyByteSize formats a byte size (int) into a human-readable colored string using binary prefixes (KiB, MiB, etc.).

Types

This section is empty.

Directories

Path Synopsis
Package config reads a yaml config file from the XDG_CONFIG_HOME and unmarshals it into a user supplied struct
Package config reads a yaml config file from the XDG_CONFIG_HOME and unmarshals it into a user supplied struct
Package logging provides slog helpers.
Package logging provides slog helpers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL