update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 17:51:13 +02:00
parent 345e0eaeaa
commit fc0f6b2ae3
4 changed files with 133 additions and 30 deletions

View File

@ -8,14 +8,27 @@
"shortDescription": "a smartlog destination for transparently writing to a file", "shortDescription": "a smartlog destination for transparently writing to a file",
"npmPackagename": "@push.rocks/smartlog-destination-file", "npmPackagename": "@push.rocks/smartlog-destination-file",
"license": "MIT", "license": "MIT",
"projectDomain": "push.rocks" "projectDomain": "push.rocks",
"description": "A module for creating a log destination that writes to a file with support for smartlog interfaces.",
"keywords": [
"logging",
"smartlog",
"file-logging",
"typescript",
"node.js",
"filesystem",
"log management",
"development tool",
"log destination",
"log file"
]
} }
}, },
"npmci": { "npmci": {
"npmGlobalTools": [], "npmGlobalTools": [],
"npmAccessLevel": "public" "npmAccessLevel": "public"
}, },
"tsdocs": { "tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n" "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
} }
} }

View File

@ -2,7 +2,7 @@
"name": "@push.rocks/smartlog-destination-file", "name": "@push.rocks/smartlog-destination-file",
"version": "1.0.7", "version": "1.0.7",
"private": false, "private": false,
"description": "a smartlog destination for transparently writing to a file", "description": "A module for creating a log destination that writes to a file with support for smartlog interfaces.",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH", "author": "Lossless GmbH",
@ -36,5 +36,17 @@
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
],
"keywords": [
"logging",
"smartlog",
"file-logging",
"typescript",
"node.js",
"filesystem",
"log management",
"development tool",
"log destination",
"log file"
] ]
} }

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

131
readme.md
View File

@ -1,39 +1,116 @@
# @pushrocks/smartfile-destination-file # @push.rocks/smartlog-destination-file
a smartlog destination for transparently writing to a file a smartlog destination for transparently writing to a file
## Availabililty and Links ## Install
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartfile-destination-file) To install `@push.rocks/smartlog-destination-file`, use the following command with npm:
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartfile-destination-file)
* [github.com (source mirror)](https://github.com/pushrocks/smartfile-destination-file)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartfile-destination-file/)
## Status for master ```bash
npm install @push.rocks/smartlog-destination-file --save
```
Status Category | Status Badge This will add the package to your project's dependencies.
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartfile-destination-file/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartfile-destination-file/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartfile-destination-file)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartfile-destination-file)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartfile-destination-file)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartfile-destination-file)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartfile-destination-file)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage ## Usage
Use TypeScript for best in class intellisense To use `@push.rocks/smartlog-destination-file` in your project, you need to import and instantiate it with the path to the log file you wish to write to. This path should be absolute to ensure correct file writing regardless of the current working directory of your application.
## Contribution First, ensure that your TypeScript configuration supports ECMAScript modules (ESM) syntax. Then, follow the steps below for setup and usage examples.
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) ### Basic Setup
For further information read the linked docs at the top of this readme. Here is how to instantiate `SmartlogDestinationFile` and use it to log messages:
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) ```typescript
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) // Import dependencies
import { SmartlogDestinationFile } from '@push.rocks/smartlog-destination-file';
import path from 'path';
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) // Define the absolute path to the log file
const logFilePath = path.resolve(__dirname, 'mylogs.log');
// Create an instance of SmartlogDestinationFile
const myLogDestination = new SmartlogDestinationFile(logFilePath);
// Example log message
const logMessage = {
context: 'ExampleApp',
correlation: {
id: 'unique-correlation-id',
type: 'example'
},
level: 'info',
message: 'This is an example log message',
timestamp: Date.now(),
type: 'log',
data: null
};
// Log the message
myLogDestination.handleLog(logMessage).then(() => {
console.log('Log message was successfully written to file');
}).catch((error) => {
console.error('Error writing log message to file:', error);
});
```
The `handleLog` method is asynchronous and returns a Promise. It's important to handle both successful and unsuccessful attempts to log messages.
### Advanced Usage
`@push.rocks/smartlog-destination-file` integrates smoothly with `@pushrocks/smartlog` to provide a structured logging solution. You can easily set it as a destination for your smartlog instance. Here's how to do it:
1. Install `@pushrocks/smartlog` along with `@push.rocks/smartlog-destination-file`:
```bash
npm install @push.rocks/smartlog @push.rocks/smartlog-destination-file --save
```
2. Set up `SmartlogDestinationFile` as a destination in `Smartlog`:
```typescript
import { Smartlog } from '@pushrocks/smartlog';
import { SmartlogDestinationFile } from '@push.rocks/smartlog-destination-file';
import path from 'path';
const logFilePath = path.resolve(__dirname, 'myStructuredLogs.log');
const fileDestination = new SmartlogDestinationFile(logFilePath);
// Initialize Smartlog
const myLogger = new Smartlog({
minLevel: 'info',
destinations: [
fileDestination // Your instance of SmartlogDestinationFile
]
});
// Use Smartlog to log a message
myLogger.log({
level: 'info',
message: 'Structured log message with Smartlog and SmartlogDestinationFile',
type: 'business',
context: 'exampleContext'
});
```
This setup gives you the power of structured logging with the convenience of `@pushrocks/smartlog`'s log management capabilities, directing all logs to a file specified in `SmartlogDestinationFile`.
Remember, `@push.rocks/smartlog-destination-file` is versatile and can be adapted to various logging strategies, playing a crucial role in the observability and debugging capabilities of your application. By leveraging its simplicity and integration with `@pushrocks/smartlog`, you can achieve an effective logging solution with minimal setup.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.