🚀 Launch Week Day 3:Introducing Supply Chain Attack Campaigns Tracking.Learn More →
Socket
Book a DemoInstallSign in
Socket

zuern.dev/zlog

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zuern.dev/zlog

Go Modules
Version
v0.1.0
Version published
Created
Source

zlog

Package zlog provides a minimal setup for log/slog with sensible defaults.

Quick start

package main

import (
	"flag"
	"log/slog"

	"zuern.dev/zlog"
)

func main() {
	level := zlog.RegisterLevelFlag(flag.CommandLine)
	flag.Parse()

	zlog.Init(level)
	slog.Info("service started", slog.String("version", "1.2.3"))
}

Output format

The handler format is selected in this order:

  • LOG_FORMAT=json or LOG_FORMAT=text if set.
  • Otherwise, text format when stderr is a TTY and JSON when it is not.

Attribution

The pretty text handler in prettylog is derived from dusted-go/logging's handlers/prettylog and is licensed under Apache 2.0. See https://github.com/dusted-go/logging/tree/main/handlers/prettylog.

FAQs

Package last updated on 18 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts