Sample
github.com/go-kit/log v0.1.0: level.Debug
Verified sample for golang github.com/go-kit/log v0.1.0: level.Debug. The contract ran on go 1.26 · linux debian/x64 · docker and passed.
sha256:5521a6a980a0abdfb561a101c01ac9353520ab4f3399c60692b0cb9c1d225cd0
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 go
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| go 1.26 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-09-04 |
Case
HOW- Goal
- verify github.com/go-kit/log/level.Debug in pkg:golang/github.com/go-kit/log@v0.1.0
- Packages
- Symbols
-
- github.com/go-kit/log/level.Debug
- Created
- 2026-09-04T03:51:38Z
Contract
- level.Debug decorates a logger to prepend level key and debug value to log records
- level.Debug produces formatted debug output in JSON logger
- level.NewFilter squelches level.Debug calls when configured with AllowInfo
- level.NewFilter permits level.Debug calls when configured with AllowDebug
- level.NewFilter with ErrNotAllowed returns configured error when level.Debug is squelched
Files
- PROMPT.md
- csx.json
- debug.go
- go.mod
- go.sum
- spec.json
- test/contract.go
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify github.com/go-kit/log/level.Debug in pkg:golang/github.com/go-kit/log@v0.1.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/go-kit/log@v0.1.0
Demonstrate these symbols/APIs:
- github.com/go-kit/log/level.Debug
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:c7e3765b188bb92661e2a380a86f641426e4ac25ecb4828effc07ef945e55210","contract":["level.Debug decorates a logger to prepend level key and debug value to log records","level.Debug produces formatted debug output in JSON logger","level.NewFilter squelches level.Debug calls when configured with AllowInfo","level.NewFilter permits level.Debug calls when configured with AllowDebug","level.NewFilter with ErrNotAllowed returns configured error when level.Debug is squelched"],"goal":"verify github.com/go-kit/log/level.Debug in pkg:golang/github.com/go-kit/log@v0.1.0","kind":"HOW","packages":["pkg:golang/github.com/go-kit/log@v0.1.0"],"schemaVersion":1,"symbols":["github.com/go-kit/log/level.Debug"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/go-kit/log@v0.1.0"],"schemaVersion":1,"subject":"pkg:golang/github.com/go-kit/log@v0.1.0","symbols":["github.com/go-kit/log/level.Debug"],"verifierAdapter":"golang@1"}
package sample
import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"
)
// LogDebug logs a debug-level message with key-value pairs using level.Debug.
func LogDebug(logger log.Logger, keyvals ...interface{}) error {
return level.Debug(logger).Log(keyvals...)
}
// NewDebugFilter returns a filtered logger that permits debug level and above.
func NewDebugFilter(logger log.Logger) log.Logger {
return level.NewFilter(logger, level.AllowDebug())
}
// NewInfoFilter returns a filtered logger that squelches debug level events.
func NewInfoFilter(logger log.Logger) log.Logger {
return level.NewFilter(logger, level.AllowInfo())
}
module example.com/gokit-level-debug
go 1.22.0
require github.com/go-kit/log v0.1.0
require github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-kit/log v0.1.0 h1:DGJh0Sm43HbOeYDNnVZFl8BvcYVvjD5bqYJvp0REbwQ=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
{
"schemaVersion": 1,
"goal": "verify github.com/go-kit/log/level.Debug in pkg:golang/github.com/go-kit/log@v0.1.0",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/go-kit/log@v0.1.0"
],
"symbols": [
"github.com/go-kit/log/level.Debug"
]
}
package main
import (
"bytes"
"errors"
"fmt"
"os"
"strings"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
sample "example.com/gokit-level-debug"
)
func main() {
// Assertion 1: level.Debug decorates a logger to prepend level key and debug value to log records
{
var buf bytes.Buffer
logger := log.NewLogfmtLogger(&buf)
debugLogger := level.Debug(logger)
err := debugLogger.Log("msg", "processing item", "id", 101)
if err != nil {
fmt.Fprintf(os.Stderr, "Contract 1 failed: %v\n", err)
os.Exit(1)
}
expected := "level=debug msg=\"processing item\" id=101\n"
if buf.String() != expected {
fmt.Fprintf(os.Stderr, "Contract 1 failed: expected %q, got %q\n", expected, buf.String())
os.Exit(1)
}
}
// Assertion 2: level.Debug produces formatted debug output in JSON logger
{
var buf bytes.Buffer
jsonLogger := log.NewJSONLogger(&buf)
err := level.Debug(jsonLogger).Log("event", "cache_lookup", "hit", true)
if err != nil {
fmt.Fprintf(os.Stderr, "Contract 2 failed: %v\n", err)
os.Exit(1)
}
out := strings.TrimSpace(buf.String())
expected := `{"event":"cache_lookup","hit":true,"level":"debug"}`
if out != expected {
fmt.Fprintf(os.Stderr, "Contract 2 failed: expected %q, got %q\n", expected, out)
os.Exit(1)
}
}
// Assertion 3: level.NewFilter squelches level.Debug calls when configured with AllowInfo
{
var buf bytes.Buffer
baseLogger := log.NewLogfmtLogger(&buf)
filterLogger := level.NewFilter(baseLogger, level.AllowInfo())
err := level.Debug(filterLogger).Log("msg", "diagnostic details")
if err != nil {
fmt.Fprintf(os.Stderr, "Contract 3 failed: expected nil error on squelch, got %v\n", err)
os.Exit(1)
}
if buf.Len() != 0 {
fmt.Fprintf(os.Stderr, "Contract 3 failed: expected empty buffer for squelched debug log, got %q\n", buf.String())
os.Exit(1)
}
err = level.Info(filterLogger).Log("msg", "system operational")
if err != nil {
fmt.Fprintf(os.Stderr, "Contract 3 failed: %v\n", err)
os.Exit(1)
}
expectedInfo := "level=info msg=\"system operational\"\n"
if buf.String() != expectedInfo {
fmt.Fprintf(os.Stderr, "Contract 3 failed: expected %q, got %q\n", expectedInfo, buf.String())
os.Exit(1)
}
}
// Assertion 4: level.NewFilter permits level.Debug calls when configured with AllowDebug
{
var buf bytes.Buffer
baseLogger := log.NewLogfmtLogger(&buf)
filterLogger := level.NewFilter(baseLogger, level.AllowDebug())
err := level.Debug(filterLogger).Log("msg", "verbose tracing", "step", 2)
if err != nil {
fmt.Fprintf(os.Stderr, "Contract 4 failed: %v\n", err)
os.Exit(1)
}
expected := "level=debug msg=\"verbose tracing\" step=2\n"
if buf.String() != expected {
fmt.Fprintf(os.Stderr, "Contract 4 failed: expected %q, got %q\n", expected, buf.String())
os.Exit(1)
}
}
// Assertion 5: level.NewFilter with ErrNotAllowed returns configured error when level.Debug is squelched
{
var buf bytes.Buffer
baseLogger := log.NewLogfmtLogger(&buf)
errNotAllowed := errors.New("log level not permitted")
filterLogger := level.NewFilter(baseLogger, level.AllowWarn(), level.ErrNotAllowed(errNotAllowed))
err := level.Debug(filterLogger).Log("msg", "should return error")
if !errors.Is(err, errNotAllowed) {
fmt.Fprintf(os.Stderr, "Contract 5 failed: expected errNotAllowed, got %v\n", err)
os.Exit(1)
}
if buf.Len() != 0 {
fmt.Fprintf(os.Stderr, "Contract 5 failed: expected empty buffer, got %q\n", buf.String())
os.Exit(1)
}
}
// Assertion 6: sample package helpers verify level.Debug integration
{
var buf bytes.Buffer
baseLogger := log.NewLogfmtLogger(&buf)
debugLogger := sample.NewDebugFilter(baseLogger)
if err := sample.LogDebug(debugLogger, "component", "auth", "event", "token_verified"); err != nil {
fmt.Fprintf(os.Stderr, "Contract 6 failed: %v\n", err)
os.Exit(1)
}
expected := "level=debug component=auth event=token_verified\n"
if buf.String() != expected {
fmt.Fprintf(os.Stderr, "Contract 6 failed: expected %q, got %q\n", expected, buf.String())
os.Exit(1)
}
buf.Reset()
infoLogger := sample.NewInfoFilter(baseLogger)
if err := sample.LogDebug(infoLogger, "component", "auth", "event", "ignored_trace"); err != nil {
fmt.Fprintf(os.Stderr, "Contract 6 failed: %v\n", err)
os.Exit(1)
}
if buf.Len() != 0 {
fmt.Fprintf(os.Stderr, "Contract 6 failed: expected empty buffer for filtered debug log, got %q\n", buf.String())
os.Exit(1)
}
}
fmt.Println("All level.Debug contract assertions passed.")
}
Origin Seeder
anonymous