{"_rev":"7-af88f336ea1ea75858f0c10d1afedb57","time":{"created":"2025-06-15T21:46:25.779Z","modified":"2025-06-15T21:46:26.236Z","1.0.0":"2025-06-15T20:23:42.905Z","1.0.1":"2025-06-15T20:34:07.201Z","1.0.0-alpha":"2025-06-15T21:23:49.504Z","1.0.0-alpha.1":"2025-06-15T21:41:11.653Z","1.0.0-alpha.0.1":"2025-06-15T21:46:26.005Z"},"_id":"@alkaline-git/git-log","name":"@alkaline-git/git-log","dist-tags":{"alpha":"1.0.0-alpha.0.1","latest":"1.0.0-alpha.0.1"},"versions":{"1.0.0-alpha.0.1":{"name":"@alkaline-git/git-log","version":"1.0.0-alpha.0.1","description":"> Git-aware logging SDK for developers. Correlate logs with Git commits and deploys.","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","require":"./dist/index.js"}},"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"dependencies":{"better-sqlite3":"^11.10.0","mysql2":"^3.14.1","pg":"^8.16.0","simple-git":"^3.28.0","winston":"^3.17.0"},"devDependencies":{"@types/better-sqlite3":"^7.6.13","@types/pg":"^8.15.4","typescript":"^5.5.3"},"publishConfig":{"access":"public"},"_id":"@alkaline-git/git-log@1.0.0-alpha.0.1","gitHead":"bdfd328dbb7cad8b8a8f60a022433f594441494e","_nodeVersion":"23.10.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-U9sJ/RILpLpsn+XqpzEM3DdIi/mEw1x2ALBGKoSIih4tOQG+tD/I50kg/NFNNfanmRfRhUXvYstMW2BLDTbxjQ==","shasum":"359164d11acd05a6573091650fbe1c1b078dffc4","tarball":"https://registry.npmjs.org/@alkaline-git/git-log/-/git-log-1.0.0-alpha.0.1.tgz","fileCount":38,"unpackedSize":28283,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCYIEm6MXpHG5tvkQ+wRek2RXixGN2X2Kw4+Z2mEa0qDAIgTOKRD9ljt5bE13h1iKv/vuYMdKo0t3c5KoF1Z/A4+uA="}]},"_npmUser":{"name":"alkaline-git","email":"masbblake@gmail.com"},"directories":{},"maintainers":[{"name":"alkaline-git","email":"masbblake@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/git-log_1.0.0-alpha.0.1_1750023985838_0.6691561516924232"},"_hasShrinkwrap":false}},"maintainers":[{"name":"alkaline-git","email":"masbblake@gmail.com"}],"description":"> Git-aware logging SDK for developers. Correlate logs with Git commits and deploys.","readme":"# @alkaline/git-log\n\n> Git-aware logging SDK for developers. Correlate logs with Git commits and deploys.\n\n## Overview\n@alkaline/git-log is a powerful logging library that integrates with Git to provide context-aware logging capabilities. It supports multiple transport layers and can be easily configured to match your logging needs.\n\n## Features\n- Git-aware logging\n- Multiple transport options (SQL, HTTP, SQLite)\n- Configurable severity levels\n- TypeScript support\n- Async logging capabilities\n\n## Installation\n```bash\n    npm install @alkaline-git/git-log\n```\n\n## Basic Usage\n\n## Configuration\n\n> The logger can be configured with various options:\n\n\n```ts\ninterface LoggerOptions { transports: AlkalineTransport[]; level?: string; format?: Format; defaultMeta?: any; }\nconst logger = createLogger({ level: 'info', defaultMeta: { service: 'user-service' }, \n    transports: [ // Add your transports here ] \n}\n```\n\n\n## Transports\n\n### Console Transport\n> The Console transport is the simplest transport, outputting logs directly to the console.\n\n```ts\nimport { createLogger, ConsoleTransport } from '@alkaline/git-log';\n// Configure Console Transport\nconst consoleTransport = new ConsoleTransport(['info', 'error']);\n// Create logger with Console transport\nconst logger = createLogger({ transports: [consoleTransport] });\n// Usage\nlogger.info('Operation completed', { details: 'Process finished successfully' });\n```\n\n### PostgreSQL Transport\n> The PostgreSQL transport enables logging directly to a PostgreSQL database.\n\n```ts\nimport { createLogger, PostgresTransport } from '@alkaline/git-log';\n// Configure PostgreSQL Transport\nconst postgresTransport = new PostgresTransport({\n    host: 'localhost',\n    port: 5432,\n    database: 'logs_db',\n    user: 'postgres_user', \n    password: 'postgres_password',\n    query: (info) => ({\n        stmt: 'INSERT INTO logs(level, message, timestamp, metadata) VALUES(1,2, 3,4)',\n        params: [ info.level, info.message, new Date(), JSON.stringify(info.metadata) ] \n    }) \n}, ['info', 'error']);\n// Create logger with PostgreSQL transport\nconst logger = createLogger({ transports: [postgresTransport] });\n// Usage \nlogger.info('Database operation completed', { operation: 'data_sync' });\n```\n\n### SQL Transport\n> The SQL transport allows you to store logs directly in SQL databases like MySQL.\n\n```ts\nimport { createLogger, SqlTransport } from '@alkaline/git-log';\n// Configure SQL Transport\nconst sqlTransport = new SqlTransport({ \n    host: 'localhost', \n    user: 'database_user', \n    password: 'database_password', \n    database: 'logs_db', \n    uery: (info) => ({ \n        stmt: 'INSERT INTO logs (level, message, timestamp) VALUES (?, ?, ?)', \n        params: [info.level, info.message, new Date()]\n    })\n}, ['info', 'error']);\n// Create logger with SQL transport\nconst logger = createLogger({ transports: [sqlTransport] });\n// Usage \nlogger.info('Database operation completed');\n```\n\n### HTTP Transport\n> The HTTP transport enables sending logs to remote endpoints via HTTP/HTTPS.\n\n```ts\nimport { createLogger, HttpTransport, HttpMethod } from '@alkaline/git-log';\n// Configure HTTP Transport \nconst httpTransport = new HttpTransport({ \n    url: '[https://logging-api.example.com/logs](https://logging-api.example.com/logs)',\n    method: HttpMethod.POST, \n    headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer your-api-token' }, \n    buildBody: (info) => JSON.stringify({ \n        level: info.level, \n        message: info.message, \n        timestamp: new Date(), \n        metadata: info.metadata \n    }) \n}, ['info', 'error']);\n// Create logger with HTTP transport\nconst logger = createLogger({ transports: [httpTransport] });\n// Usage\nlogger.info('API request completed', { requestId: '123' });\n```\n\n\n### SQLite Transport\n> The SQLite transport provides local database logging capabilities.\n\n```ts\nimport { createLogger, LiteTransport } from '@alkaline/git-log';\n\n// Configure SQLite Transport\nconst liteTransport = new LiteTransport({\n  dbName: 'application_logs.db',\n  query: (info) => ({\n    stmt: 'INSERT INTO logs (level, message, timestamp, metadata) VALUES (?, ?, ?, ?)',\n    params: [\n      info.level,\n      info.message,\n      new Date().toISOString(),\n      JSON.stringify(info.metadata)\n    ]\n  })\n}, ['info', 'error']);\n\n// Create logger with SQLite transport\nconst logger = createLogger({\n  transports: [liteTransport]\n});\n\n// Usage\nlogger.info('Local operation completed', { operationId: 'op123' });\n```\n\n## Using Multiple Transports\n> You can combine multiple transports in a single logger instance:\n\n```ts\nconst logger = createLogger({\n  transports: [\n    consoleTransport,  // For local debugging\n    postgresTransport, // For persistent storage\n    httpTransport      // For remote logging service\n  ]\n});\n\n// Logs will be sent to all configured transports\nlogger.info('Important operation completed');\n```\n\n## Error Handling\n> All transports handle errors gracefully and include built-in error logging:\n```ts\nlogger.error('Operation failed', {\n  error: new Error('Database connection failed'),\n  context: {\n    operation: 'database_sync',\n    timestamp: new Date()\n  }\n});\n```\n## Contributing\n > Contributions are welcome! Please feel free to submit a Pull Request.\n> \n## License\n [MIT](LICENSE)\n``` \n\nThe README now includes all five transport types:\n1. Console Transport (for simple console output)\n2. PostgreSQL Transport (for PostgreSQL databases)\n3. SQL Transport (for MySQL and other SQL databases)\n4. HTTP Transport (for remote logging endpoints)\n5. SQLite Transport (for local SQLite databases)\n\nEach transport section includes configuration examples and usage patterns. The multiple transports example has also been updated to show a more realistic combination of different transport types.\n```\n","readmeFilename":"README.md"}