Installation

How to install and set up the Rivaas logging package

This guide covers how to install the logging package and understand its dependencies.

Installation

Install the logging package using go get:

go get rivaas.dev/logging

Requirements: Go 1.25 or higher

Dependencies

The logging package has minimal external dependencies to maintain simplicity and avoid bloat.

DependencyPurposeRequired
Go stdlib (log/slog)Core loggingYes
go.opentelemetry.io/otel/traceTrace correlation in ContextLoggerOptional*
github.com/stretchr/testifyTest utilitiesTest only

* The OpenTelemetry trace dependency is only used by NewContextLogger() for automatic trace/span ID extraction. If you don’t use context-aware logging with tracing, this dependency has no runtime impact.

Verifying Installation

Create a simple test to verify the installation:

package main

import (
    "rivaas.dev/logging"
)

func main() {
    log := logging.MustNew(
        logging.WithConsoleHandler(),
    )
    
    log.Info("installation successful", "version", "v1.0.0")
}

Run the program:

go run main.go

You should see output like:

10:30:45.123 INFO  installation successful version=v1.0.0

Import Statement

Import the logging package in your Go files:

import "rivaas.dev/logging"

For context-aware logging with OpenTelemetry:

import (
    "rivaas.dev/logging"
    "go.opentelemetry.io/otel/trace"
)

Module Integration

Add to your go.mod:

module example.com/myapp

go 1.25

require (
    rivaas.dev/logging v1.0.0
)

Run go mod tidy to download dependencies:

go mod tidy

Next Steps

For complete API details, see the API Reference.