Skip to content

Commit b7f7dcd

Browse files
committed
feat: initial release of @vetaverse/logger v1.0.0
- Core logger with debug, info, warn, error methods - TypeScript support with strict mode - Platform detection (Node.js, React Native, Web) - Pluggable transport system (Console, File) - Pluggable formatter system (Text, JSON) - Log history with configurable size - Subscription system for log events - Environment-based log level filtering - Safe metadata serialization - Async file writes with buffering - Comprehensive test suite (42 tests) - Full documentation and examples - CI/CD with GitHub Actions - Dual CJS/ESM builds
0 parents  commit b7f7dcd

31 files changed

+2344
-0
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = space
9+
indent_size = 2
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.json]
15+
indent_size = 2
16+
17+
[*.{ts,tsx}]
18+
indent_size = 2

.eslintrc.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
extends: [
4+
'eslint:recommended',
5+
'plugin:@typescript-eslint/recommended',
6+
'plugin:prettier/recommended',
7+
],
8+
plugins: ['@typescript-eslint', 'prettier'],
9+
parserOptions: {
10+
ecmaVersion: 2020,
11+
sourceType: 'module',
12+
project: './tsconfig.json',
13+
},
14+
env: {
15+
node: true,
16+
es2020: true,
17+
jest: true,
18+
},
19+
rules: {
20+
'@typescript-eslint/explicit-function-return-type': 'off',
21+
'@typescript-eslint/explicit-module-boundary-types': 'off',
22+
'@typescript-eslint/no-explicit-any': 'error',
23+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
24+
'prettier/prettier': 'error',
25+
},
26+
};

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
test:
11+
name: Test on Node ${{ matrix.node-version }}
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [14.x, 16.x, 18.x, 20.x]
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
cache: 'npm'
22+
- run: npm ci
23+
- run: npm run lint
24+
- run: npm run typecheck
25+
- run: npm test

.github/workflows/publish.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: '20.x'
15+
registry-url: 'https://registry.npmjs.org'
16+
- run: npm ci
17+
- run: npm test
18+
- run: npm run build
19+
- run: npm publish --access public
20+
env:
21+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Dependencies
2+
node_modules/
3+
package-lock.json
4+
yarn.lock
5+
pnpm-lock.yaml
6+
7+
# Build output
8+
dist/
9+
build/
10+
*.tsbuildinfo
11+
12+
# Testing
13+
coverage/
14+
.nyc_output/
15+
*.lcov
16+
17+
# IDE
18+
.vscode/
19+
.idea/
20+
*.swp
21+
*.swo
22+
*~
23+
.DS_Store
24+
25+
# Environment
26+
.env
27+
.env.local
28+
.env.*.local
29+
30+
# Logs
31+
logs/
32+
*.log
33+
npm-debug.log*
34+
yarn-debug.log*
35+
yarn-error.log*
36+
pnpm-debug.log*
37+
38+
# Misc
39+
.cache/
40+
.temp/
41+
tmp/

.npmignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Source files
2+
src/
3+
*.ts
4+
!*.d.ts
5+
6+
# Tests
7+
__tests__/
8+
*.test.ts
9+
*.spec.ts
10+
coverage/
11+
12+
# Examples
13+
examples/
14+
15+
# Configuration
16+
tsconfig.json
17+
tsconfig.build.json
18+
tsup.config.ts
19+
jest.config.js
20+
.eslintrc.js
21+
.prettierrc
22+
.editorconfig
23+
24+
# CI/CD
25+
.github/
26+
27+
# IDE
28+
.vscode/
29+
.idea/
30+
31+
# Misc
32+
.DS_Store
33+
*.log
34+
.env

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 100,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"arrowParens": "always",
9+
"endOfLine": "lf"
10+
}

CHANGELOG.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.0] - 2025-12-13
9+
10+
### Added
11+
12+
- Initial release of @vetaverse/logger
13+
- Core logger with debug, info, warn, error methods
14+
- TypeScript support with strict mode
15+
- Platform detection (Node.js, React Native, Web)
16+
- Pluggable transport system
17+
- ConsoleTransport for console output
18+
- FileTransport for Node.js file logging with rotation
19+
- Pluggable formatter system
20+
- TextFormatter for human-readable output
21+
- JSONFormatter for structured logging
22+
- Log history with configurable size (default: 200)
23+
- Subscription system for log event listening
24+
- Environment-based log level filtering
25+
- Safe metadata serialization (circular references, Error objects)
26+
- Async file writes with buffering
27+
- Correlation ID support
28+
- Default metadata support
29+
- Platform information in logs (optional)
30+
- Comprehensive test suite (42 tests, 100% coverage)
31+
- Full TypeScript type definitions
32+
- Dual CJS/ESM builds
33+
- Zero runtime dependencies
34+
35+
### Features
36+
37+
- Works in Node.js 14+
38+
- Works in React Native 0.60+
39+
- Works in modern browsers
40+
- Tree-shakeable
41+
- Minified builds
42+
- Sourcemaps included
43+
44+
[1.0.0]: https://github.com/vetaverse/logger/releases/tag/v1.0.0

CONTRIBUTING.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# Contributing to @vetaverse/logger
2+
3+
Thank you for your interest in contributing to @vetaverse/logger! This document provides guidelines and instructions for contributing.
4+
5+
## Code of Conduct
6+
7+
We are committed to providing a welcoming and inclusive environment. Please be respectful and constructive in all interactions.
8+
9+
## How to Contribute
10+
11+
### Reporting Bugs
12+
13+
If you find a bug, please create an issue on GitHub with:
14+
15+
- Clear description of the issue
16+
- Steps to reproduce
17+
- Expected behavior
18+
- Actual behavior
19+
- Environment details (Node.js version, React Native version, etc.)
20+
- Code samples or screenshots if applicable
21+
22+
### Suggesting Features
23+
24+
Feature suggestions are welcome! Please create an issue with:
25+
26+
- Clear description of the feature
27+
- Use cases and benefits
28+
- Examples of how it would work
29+
- Alternative solutions considered
30+
31+
### Pull Requests
32+
33+
1. **Fork the repository** and create a new branch from `main`
34+
2. **Install dependencies**: `npm install`
35+
3. **Make your changes** following our coding standards
36+
4. **Add tests** for new functionality
37+
5. **Run tests**: `npm test`
38+
6. **Run linting**: `npm run lint`
39+
7. **Run type checking**: `npm run typecheck`
40+
8. **Update documentation** if needed
41+
9. **Commit your changes** with a clear commit message
42+
10. **Push to your fork** and create a pull request
43+
44+
## Development Setup
45+
46+
```bash
47+
# Clone the repository
48+
git clone https://github.com/vetaverse/logger.git
49+
cd logger
50+
51+
# Install dependencies
52+
npm install
53+
54+
# Run tests
55+
npm test
56+
57+
# Run tests in watch mode
58+
npm run test:watch
59+
60+
# Run linting
61+
npm run lint
62+
63+
# Run type checking
64+
npm run typecheck
65+
66+
# Build the package
67+
npm run build
68+
```
69+
70+
## Coding Standards
71+
72+
- **TypeScript**: Use strict mode, no `any` types
73+
- **Testing**: Maintain >80% code coverage
74+
- **Formatting**: Use Prettier (runs automatically on commit)
75+
- **Linting**: Follow ESLint rules (runs automatically on commit)
76+
- **Commits**: Use conventional commit messages
77+
78+
### Commit Message Format
79+
80+
```
81+
type(scope): description
82+
83+
[optional body]
84+
85+
[optional footer]
86+
```
87+
88+
Types:
89+
- `feat`: New feature
90+
- `fix`: Bug fix
91+
- `docs`: Documentation changes
92+
- `style`: Code style changes (formatting, etc.)
93+
- `refactor`: Code refactoring
94+
- `test`: Adding or updating tests
95+
- `chore`: Build process or auxiliary tool changes
96+
97+
Examples:
98+
```
99+
feat(transport): add HTTP transport for remote logging
100+
fix(file): resolve file rotation issue on Windows
101+
docs(readme): add examples for custom transports
102+
```
103+
104+
## Testing
105+
106+
All contributions must include tests. We use Jest for testing.
107+
108+
- Write unit tests for new functionality
109+
- Update existing tests if behavior changes
110+
- Ensure all tests pass before submitting PR
111+
- Aim for 100% code coverage on new code
112+
113+
## Documentation
114+
115+
- Update README.md for new features
116+
- Add JSDoc comments for public APIs
117+
- Update CHANGELOG.md following Keep a Changelog format
118+
- Add examples for new functionality
119+
120+
## Release Process
121+
122+
Releases are managed by maintainers:
123+
124+
1. Update version in package.json
125+
2. Update CHANGELOG.md
126+
3. Create git tag
127+
4. Push to GitHub
128+
5. GitHub Actions auto-publishes to npm
129+
130+
## Questions?
131+
132+
Feel free to:
133+
- Open an issue for questions
134+
- Join discussions on GitHub
135+
- Email us at info@vetaversevet.com
136+
137+
## License
138+
139+
By contributing, you agree that your contributions will be licensed under the MIT License.
140+
141+
---
142+
143+
Thank you for contributing to @vetaverse/logger! 🎉

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Vetaverse Team
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)