update tsconfig

This commit is contained in:
Philipp Kunz 2024-04-14 17:53:29 +02:00
parent 57433e2b4a
commit d5a9e1ce69
4 changed files with 152 additions and 37 deletions

View File

@ -9,12 +9,23 @@
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartlog-interfaces",
"description": "interfaces for the smartlog ecosystem",
"description": "Defines interfaces for the smartlog ecosystem.",
"npmPackagename": "@push.rocks/smartlog-interfaces",
"license": "MIT"
"license": "MIT",
"keywords": [
"logging",
"interfaces",
"typescript",
"smartlog",
"log management",
"log interface",
"ecosystem",
"node.js",
"typescript definitions"
]
}
},
"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"
}
}

View File

@ -2,7 +2,7 @@
"name": "@push.rocks/smartlog-interfaces",
"version": "3.0.0",
"private": false,
"description": "interfaces for the smartlog ecosystem",
"description": "Defines interfaces for the smartlog ecosystem.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"author": "Lossless GmbH",
@ -13,11 +13,11 @@
"buildDocs": "tsdoc"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.29",
"@gitzone/tsrun": "^1.2.18",
"@gitzone/tstest": "^1.0.64",
"@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^18.11.6"
"@gitzone/tsbuild": "^2.1.66",
"@gitzone/tsrun": "^1.2.42",
"@gitzone/tstest": "^1.0.74",
"@pushrocks/tapbundle": "^5.0.8",
"@types/node": "^20.4.1"
},
"dependencies": {
"@apiglobal/typedrequest-interfaces": "^2.0.1"
@ -37,5 +37,16 @@
"browserslist": [
"last 1 chrome versions"
],
"type": "module"
"type": "module",
"keywords": [
"logging",
"interfaces",
"typescript",
"smartlog",
"log management",
"log interface",
"ecosystem",
"node.js",
"typescript definitions"
]
}

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

146
readme.md
View File

@ -1,39 +1,131 @@
# @pushrocks/smartlog-interfaces
# @push.rocks/smartlog-interfaces
interfaces for the smartlog ecosystem
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartlog-interfaces)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartlog-interfaces)
* [github.com (source mirror)](https://github.com/pushrocks/smartlog-interfaces)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartlog-interfaces/)
## Install
To install `@push.rocks/smartlog-interfaces`, ensure you have Node.js and npm installed. Then, run the following command in your project directory:
## Status for master
```sh
npm install @push.rocks/smartlog-interfaces --save
```
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartlog-interfaces/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartlog-interfaces/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartlog-interfaces)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartlog-interfaces)](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/smartlog-interfaces)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartlog-interfaces)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartlog-interfaces)](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)
This command adds `@push.rocks/smartlog-interfaces` to your package's dependencies and downloads it into the `node_modules` folder.
## Usage
Use TypeScript for best in class instellisense.
`@push.rocks/smartlog-interfaces` provides TypeScript interfaces for structuring log messages within the Smartlog ecosystem. These interfaces standardize how log data is structured and transmitted across different parts of a system, making it easier to collect, query, and analyze logs.
## Contribution
The Smartlog ecosystem is designed to support a versatile range of logging needs, from simple application logs to complex, structured data logging for microservices. To utilize these interfaces in your project, follow the steps below:
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). :)
### Setting Up
For further information read the linked docs at the top of this readme.
First, ensure you're using TypeScript in your project. Install TypeScript if you haven't already:
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
```sh
npm install typescript --save-dev
```
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
Then, import the necessary interfaces from the package in your logging module or any place you intend to produce logs:
```typescript
import {
ILogPackage,
ILogDestination,
TLogLevel,
TLogType,
ILogContext,
TRuntime,
TEnvironment,
ILogCorrelation
} from '@push.rocks/smartlog-interfaces';
```
### Creating a Log Message
Here's how to create a log package conforming to the `ILogPackage` interface:
```typescript
const myLogContext: ILogContext = {
environment: 'production' as TEnvironment,
runtime: 'node' as TRuntime,
zone: 'eu-central-1'
};
const myLogCorrelation: ILogCorrelation = {
id: '123456789',
type: 'service'
};
const myLogPackage: ILogPackage = {
timestamp: Date.now(),
type: 'log' as TLogType,
context: myLogContext,
level: 'info' as TLogLevel,
correlation: myLogCorrelation,
message: 'This is a sample log message.',
};
```
In this example, `myLogPackage` encapsulates all the required data for a log message, including contextual data about where and when the log was generated.
### Implementing ILogDestination
`ILogDestination` is an interface that defines how log packages are handled. You can implement your own log destination (e.g., a cloud-based logging service, local log file writer) by conforming to this interface.
```typescript
class MyLogService implements ILogDestination {
async handleLog(logPackage: ILogPackage): Promise<void> {
// Implement log handling logic here.
// For demonstration, we'll simply log to the console.
console.log(JSON.stringify(logPackage));
}
}
// Usage
const myLogService = new MyLogService();
await myLogService.handleLog(myLogPackage);
```
This basic implementation of `ILogDestination` offers a foundational structure on which you can build more sophisticated log handling mechanisms, like batch processing, filtering, or routing based on log metadata.
### Extending Functionality
The interfaces provided by `@push.rocks/smartlog-interfaces` serve as a starting point. In a complex application or service, you might need to extend these interfaces with additional properties or create new interfaces that extend these base interfaces to include more specific log data relevant to your application.
#### Custom Log Data
For example, if your application needs to log request-specific information, you could extend `ILogPackage`:
```typescript
interface ILogPackageWithRequestData extends ILogPackage<ILogPackageDataRequest> {
// You can add more fields or override existing ones
}
// Then, when creating a log package:
const myLogPackageWithRequestData: ILogPackageWithRequestData = {
// Include all required fields from ILogPackage
// And add your additional request-specific log data in the 'data' field
};
```
### Conclusion
`@push.rocks/smartlog-interfaces` provides the foundation for consistent and structured logging across your applications and services. By adhering to the interfaces defined in the package, you can ensure that your logs are standardized, making them easier to query, analyze, and understand. Whether you're developing a small application or a large, distributed system, these interfaces offer the flexibility and structure needed to implement robust logging practices.
## 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.