logging

logging is a cursor rule for Cursor from bernierllc/agents-environment-config. It costs 0 tokens per session (506 once invoked), scanned A, original, MIT.

A collection of standards and usage patterns for application logs, which are records of what software is doing.

In plain words
What is it for?
Use it when adding logging or deciding how software should record errors, events, and diagnostic information.
Why use it?
It gives developers consistent rules for recording events and using loggers across a codebase.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding logging or deciding how software should record errors, events, and diagnostic information.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/bernierllc/agents-environment-config/logging
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/bernierllc/agents-environment-config

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for logging

README.md
[![agentmods](https://agentmods.dev/badge/rules/bernierllc/agents-environment-config/logging/github.svg)](https://agentmods.dev/rules/bernierllc/agents-environment-config/logging)
Your own site
<a href="https://agentmods.dev/rules/bernierllc/agents-environment-config/logging"><img src="https://agentmods.dev/badge/rules/bernierllc/agents-environment-config/logging/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for logging

Your own site · 80×15
<a href="https://agentmods.dev/rules/bernierllc/agents-environment-config/logging"><img src="https://agentmods.dev/badge/rules/bernierllc/agents-environment-config/logging.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 506 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00506
Opus 5.5 $0.00000 $0.00202
Sonnet 5.5 $0.00000 $0.00101
Haiku 4.5 $0.00000 $0.00051

Measured 1mo ago against content hash 71667ffc6bc7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

logging scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/topics/quality/logging.mdc · 84 lines

How it starts

The opening of the file, as written. The whole thing — 84 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Logging Standards

Logger Usage

Use Logger Factory

Use @lib/logger-factory for auditLogger, systemLogger, or browserLogger instead of console.log.

Logger Types

auditLogger
  • Usage: API routing ONLY
  • Output: Writes to audit_log database table
  • When: For tracking API requests and user actions
import { auditLogger } from '@/lib/logger-factory';

export const POST = async (request: NextRequest) => {
  auditLogger.info('API request received', { endpoint: '/api/users' });
  // Implementation
};
browserLogger
  • Usage: Browser context ONLY
  • Output: Writes to browser console
  • When: For client-side debugging and development
import { browserLogger } from '@/lib/logger-factory';

browserLogger.info('Component mounted', { component: 'UserCard' });
systemLogger
  • Usage: Everywhere else (server-side, background jobs, etc.)
  • Output: Writes to log file
  • When: For general application logging
import { systemLogger } from '@/lib/logger-factory';

systemLogger.error('Database connection failed', { error });

Logging Best Practices

Log Levels

  • Use appropriate log levels (debug, info, warn, error)
  • Log errors with context
  • Log important business events
  • Avoid logging sensitive data

Log Context

  • Include relevant context in log messages
  • Use structured logging when possible
  • Include request IDs for tracing
  • Log performance metrics when appropriate

Prohibited Patterns

❌ NEVER DO:

  • Use console.log in production code
  • Log sensitive data (passwords, tokens, PII)
  • Log full request/response bodies
  • Use console methods directly

✅ ALWAYS DO:

  • Use appropriate logger from logger-factory
  • Log only metadata and non-sensitive information
  • Use structured logging with context
  • Follow logging standards for each environment

References

  • Security: See general/security.mdc
  • Error Handling: See topics/quality/error-handling.mdc

Read the full file on GitHub · 84 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 84 lines · 0 tokens per session scan A 71667ffc6bc7

Subscribe to this mod's changes

logging is a cursor rule published in the GitHub repository bernierllc/agents-environment-config (11 stars, last pushed 10d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 506 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.