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
- id: C1 claim: Package log implements a simple logging package. source: S1 evidence: "Package log implements a simple logging package."
- id: C2 claim: A standard Logger is available through Print, Fatal, and Panic helpers. source: S1 evidence: "helper functions Print[f|ln], Fatal[f|ln], and"
- id: C3 claim: The standard logger writes to standard error and prints the date and time. source: S2 evidence: "writes to standard error and prints the date and time"
- id: C4 claim: Ldate and Ltime are the LstdFlags combination. source: S2 evidence: "Ldate | Ltime (or LstdFlags)"
Sources
- [S1] log package reference. Go. https://pkg.go.dev/log . License: BSD-3-Clause. Accessed 2026-11-23.
- [S2] log/log.go source. Go. https://go.dev/src/log/log.go . License: BSD-3-Clause. Accessed 2026-11-23.
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
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.},
}
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.
- go-log.schema.json (schema; CC-BY-4.0)
- go-log.table.json (table; CC-BY-4.0)
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.