Skip to main content

Contributing to Logpilot

Thank you for your interest in contributing to Logpilot. This guide covers how to report bugs, propose new features, and submit pull requests.

Code of conductโ€‹

All contributors are expected to follow our Code of Conduct. We're committed to maintaining a welcoming and inclusive community.

Ways to contributeโ€‹

  • ๐Ÿ› Report a bug โ€“ open a GitHub issue
  • ๐Ÿ’ก Propose a feature โ€“ start a GitHub Discussion
  • ๐Ÿ“– Improve documentation โ€“ edit any .md file and open a pull request
  • ๐Ÿงช Add tests โ€“ increase coverage for edge cases
  • ๐Ÿ”ง Fix a bug or implement a feature โ€“ see the workflow below

Reporting bugsโ€‹

Before opening an issue, please search existing issues to avoid duplicates.

When reporting a bug, include:

  • Logpilot version (npm list logpilot)
  • Node.js version (node --version)
  • Operating system
  • Minimal reproduction โ€“ the smallest possible code that reproduces the issue
  • Expected vs actual behaviour

Use the bug report template to get started.

Development setupโ€‹

Prerequisitesโ€‹

  • Node.js 18 or higher
  • npm 9 or higher
  • Git

Fork and cloneโ€‹

# 1. Fork the repo on GitHub, then clone your fork
git clone https://github.com/YOUR-USERNAME/logpilot.git
cd logpilot

# 2. Add the upstream remote
git remote add upstream https://github.com/logpilot/logpilot.git

# 3. Install dependencies
npm install

Run testsโ€‹

# Run the full test suite
npm test

# Run tests in watch mode during development
npm run test:watch

# Check coverage report
npm run coverage

All pull requests must maintain โ‰ฅ95% code coverage.

Project structureโ€‹

logpilot/
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ index.js # Public API entry point
โ”‚ โ”œโ”€โ”€ logger.js # Core logger class
โ”‚ โ”œโ”€โ”€ transports/ # Built-in transport implementations
โ”‚ โ”‚ โ”œโ”€โ”€ stdout.js
โ”‚ โ”‚ โ”œโ”€โ”€ file.js
โ”‚ โ”‚ โ””โ”€โ”€ http.js
โ”‚ โ””โ”€โ”€ formatters/ # Log formatting utilities
โ”œโ”€โ”€ test/
โ”‚ โ”œโ”€โ”€ logger.test.js
โ”‚ โ””โ”€โ”€ transports/
โ”œโ”€โ”€ docs/ # This documentation
โ”œโ”€โ”€ CHANGELOG.md
โ””โ”€โ”€ package.json

Pull request workflowโ€‹

  1. Sync your fork with the latest upstream changes:
git fetch upstream
git checkout main
git merge upstream/main
  1. Create a branch for your change:
git checkout -b fix/null-metadata-crash
# or
git checkout -b feat/syslog-transport
  1. Make your changes and write or update tests.

  2. Lint and test before committing:

npm run lint
npm test
  1. Commit using Conventional Commits format:
git commit -m "fix: handle null values in metadata object"
git commit -m "feat: add syslog transport"
git commit -m "docs: add transport configuration examples"
  1. Push your branch and open a pull request against main.

Pull request checklistโ€‹

Before submitting, confirm your PR:

  • Passes all existing tests (npm test)
  • Includes tests for any new behaviour
  • Maintains โ‰ฅ95% code coverage
  • Follows the existing code style (npm run lint passes)
  • Updates documentation if behaviour has changed
  • Has a clear title following the Conventional Commits format
  • References any related issues (for example, Fixes #42)

Review processโ€‹

A maintainer will review your pull request within 3โ€“5 business days. We may request changes โ€“ please don't take this personally. Once approved, a maintainer will merge your PR and credit you in the changelog.