← All notes

log: a simple standard logger in Go

Answer: Package log implements a simple logging package. It defines a Logger type and a standard logger used by Print, Fatal, and Panic helpers. That standard logger writes to standard error and prints the date and time.

The standard logger

This is a simple logging package built around a Logger type.

Methods on Logger format the output.

A predefined standard logger is also available through Print, Fatal, and Panic helpers, including formatted and line variants.

Those helpers are easier to use than creating a Logger manually.

Where it writes, and flags

The standard logger writes each message to standard error and includes the date and time.

Each message appears on its own line.

Ldate together with Ltime, also called LstdFlags, control that prefix.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go, log package reference; Go, log/log.go source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Go, log package reference; Go, log/log.go source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.

Cite this

Permanent ID: iil:note:2dzshsva

iinventedlight. 2026. "log: a simple standard logger in Go." iinventedlight Library, iil:note:2dzshsva, version of 2026-11-23. https://iinventedlight.com/library/notes/go-log/. License: CC-BY-4.0.

@misc{iil_note_2dzshsva,
  author = {{iinventedlight}},
  title = {{log: a simple standard logger in Go}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-23},
  url = {https://iinventedlight.com/library/notes/go-log/},
  note = {Permanent ID iil:note:2dzshsva. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-log.md.