Skip to content

feat(logger): add shared logger package with pino integration#37

Merged
amondnet merged 3 commits into
mainfrom
36-featlsp-add-logger-package-with-pino-integration
Dec 19, 2025
Merged

feat(logger): add shared logger package with pino integration#37
amondnet merged 3 commits into
mainfrom
36-featlsp-add-logger-package-with-pino-integration

Conversation

@amondnet

Copy link
Copy Markdown
Contributor

Summary

Adds a new @pleaseai/logger package with pino integration for consistent, structured logging across the monorepo.

Changes

  • New package: @pleaseai/logger with pino wrapper

    • Structured logging with child loggers
    • Environment-based configuration (LOG_LEVEL env var)
    • Auto-detect pretty printing via NODE_ENV
    • Sensitive field redaction (password, token, apiKey, etc.)
    • Logs to stderr to avoid interfering with protocol output
  • Package integrations:

    • @pleaseai/code: Fatal error logging
    • @pleaseai/code-format: Format initialization and operations
    • @pleaseai/code-lsp: LSP server lifecycle, diagnostics, spawn operations
    • @pleaseai/dora: MCP server, port discovery, ast-grep provider

API

import { createLogger, logger, type Logger, type LogLevel } from '@pleaseai/logger'

// Create named child logger
const log = createLogger('my-component')

// Structured logging
log.info({ userId: 123 }, 'User logged in')
log.error({ err }, 'Operation failed')

Test plan

  • Logger package tests pass (7 tests)
  • All package typechecks pass
  • All package tests pass
  • Verified structured output in development mode
  • Verified JSON output in production mode

Closes #36

Create new logger package for structured logging across the monorepo:
- pino-based implementation for high performance
- Auto-detects pretty printing via NODE_ENV
- Redacts sensitive fields (password, secret, token, apiKey, etc.)
- All output to stderr (stdout reserved for protocol data)
- Typed API: createLogger(name) factory and default logger singleton

Issue: #36
Replace console.* calls with structured pino logging in:
- code: CLI error handling with fatal log
- code-format: Format initialization and formatting operations
- code-lsp: LSP server lifecycle, diagnostics, and operations
- dora: MCP server, port discovery, and ast-grep provider

All packages now use @pleaseai/logger for consistent structured logging.
@amondnet amondnet linked an issue Dec 19, 2025 that may be closed by this pull request
13 tasks
@codecov

codecov Bot commented Dec 19, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.85714% with 93 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.13%. Comparing base (74117d3) to head (a269ec7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/lsp/src/server.ts 7.57% 61 Missing ⚠️
packages/logger/src/index.ts 81.69% 13 Missing ⚠️
packages/dora/src/providers/ast-grep/downloader.ts 22.22% 7 Missing ⚠️
packages/format/src/index.ts 22.22% 7 Missing ⚠️
packages/lsp/src/index.ts 62.50% 3 Missing ⚠️
packages/dora/src/providers/ast-grep/cli.ts 66.66% 1 Missing ⚠️
packages/format/src/config/loader.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #37      +/-   ##
==========================================
+ Coverage   49.37%   50.13%   +0.76%     
==========================================
  Files          21       22       +1     
  Lines        4324     4392      +68     
==========================================
+ Hits         2135     2202      +67     
- Misses       2189     2190       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Add console.error notification for unexpected errors during pino-pretty initialization
- Distinguish expected "module not found" from unexpected errors
- Add 22 new tests for redaction functionality covering all sensitive fields
- Add tests for environment configuration (LOG_LEVEL, NODE_ENV)
- Add tests for child logger context propagation
@amondnet amondnet self-assigned this Dec 19, 2025
@amondnet
amondnet merged commit c208f35 into main Dec 19, 2025
8 of 9 checks passed
@amondnet
amondnet deleted the 36-featlsp-add-logger-package-with-pino-integration branch December 19, 2025 12:18
@passionfactory-bot passionfactory-bot Bot mentioned this pull request Dec 19, 2025
@passionfactory-bot passionfactory-bot Bot mentioned this pull request Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(lsp): add logger package with pino integration

1 participant