update tsconfig
This commit is contained in:
parent
fc2619b757
commit
459d3cc0e5
@ -5,17 +5,33 @@
|
||||
"githost": "code.foss.global",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "smartlog",
|
||||
"description": "minimalistic distributed and extensible logging tool",
|
||||
"description": "A minimalistic, distributed, and extensible logging tool supporting centralized log management.",
|
||||
"npmPackagename": "@push.rocks/smartlog",
|
||||
"license": "MIT",
|
||||
"projectDomain": "push.rocks"
|
||||
"projectDomain": "push.rocks",
|
||||
"keywords": [
|
||||
"logging",
|
||||
"log management",
|
||||
"typescript",
|
||||
"centralized logging",
|
||||
"json logging",
|
||||
"node.js",
|
||||
"distributed systems",
|
||||
"extensible logging",
|
||||
"log routing",
|
||||
"console logging",
|
||||
"log destinations",
|
||||
"log levels",
|
||||
"error tracking",
|
||||
"development tools"
|
||||
]
|
||||
}
|
||||
},
|
||||
"npmci": {
|
||||
"npmGlobalTools": [],
|
||||
"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"
|
||||
}
|
||||
}
|
18
package.json
18
package.json
@ -2,14 +2,22 @@
|
||||
"name": "@push.rocks/smartlog",
|
||||
"version": "3.0.4",
|
||||
"private": false,
|
||||
"description": "minimalistic distributed and extensible logging tool",
|
||||
"description": "A minimalistic, distributed, and extensible logging tool supporting centralized log management.",
|
||||
"keywords": [
|
||||
"logging",
|
||||
"log management",
|
||||
"typescript",
|
||||
"centralized logging",
|
||||
"json logging",
|
||||
"scalyr",
|
||||
"elasticsearch",
|
||||
"logdna"
|
||||
"node.js",
|
||||
"distributed systems",
|
||||
"extensible logging",
|
||||
"log routing",
|
||||
"console logging",
|
||||
"log destinations",
|
||||
"log levels",
|
||||
"error tracking",
|
||||
"development tools"
|
||||
],
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
@ -49,4 +57,4 @@
|
||||
"last 1 chrome versions"
|
||||
],
|
||||
"type": "module"
|
||||
}
|
||||
}
|
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
||||
|
138
readme.md
138
readme.md
@ -1,38 +1,30 @@
|
||||
# @pushrocks/smartlog
|
||||
# @push.rocks/smartlog
|
||||
|
||||
minimalistic distributed and extensible logging tool
|
||||
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartlog)
|
||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartlog)
|
||||
* [github.com (source mirror)](https://github.com/pushrocks/smartlog)
|
||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartlog/)
|
||||
## Install
|
||||
|
||||
## Status for master
|
||||
You can install `@push.rocks/smartlog` using npm:
|
||||
|
||||
Status Category | Status Badge
|
||||
-- | --
|
||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartlog/badges/master/pipeline.svg)](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartlog/badges/master/coverage.svg)](https://lossless.cloud)
|
||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartlog)](https://lossless.cloud)
|
||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartlog)](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)](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartlog)](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartlog)](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)
|
||||
```sh
|
||||
npm install @push.rocks/smartlog --save
|
||||
```
|
||||
|
||||
Ensure that you have TypeScript and node.js installed in your development environment, as this module is intended to be used with TypeScript.
|
||||
|
||||
## Usage
|
||||
|
||||
Use TypeScript for best in class instellisense.
|
||||
`@push.rocks/smartlog` is a flexible and extensible logging tool designed to provide a minimalistic yet powerful logging solution across different environments, making it especially useful in distributed systems. This documentation aims to guide you through its capabilities, setup, and how to integrate it seamlessly into your TypeScript projects.
|
||||
|
||||
smartlog id s minimal logging package that provides a consistent experience across the complete logging stack. Smartlog allows you to create a logger instance like this:
|
||||
### Creating a Logger Instance
|
||||
|
||||
Start by importing `Smartlog` and create a logger instance by providing a context that describes your logging environment:
|
||||
|
||||
```typescript
|
||||
import { Smartlog } from '@push.rocks/smartlog';
|
||||
|
||||
```ts
|
||||
import { Smartlog } from '@pushrocks/smartlog';
|
||||
const logger = new Smartlog({
|
||||
{
|
||||
logContext: {
|
||||
company: 'My awesome company',
|
||||
companyunit: 'my awesome cloud team',
|
||||
containerName: 'awesome-container',
|
||||
@ -40,49 +32,89 @@ const logger = new Smartlog({
|
||||
runtime: 'node',
|
||||
zone: 'zone x'
|
||||
}
|
||||
})
|
||||
|
||||
logger.log('silly', `a silly statement`); // log levels are shown to you by the IDE
|
||||
});
|
||||
```
|
||||
|
||||
There is also a default logger available that you can use:
|
||||
This context enriches your logs with valuable information, making them easier to filter and analyze in a distributed system.
|
||||
|
||||
```ts
|
||||
import { Smartlog, defaultLogger } from '@pushrocks/smartlog';
|
||||
### Logging Messages
|
||||
|
||||
export class MyAwesomeClass {
|
||||
constructor(public logger: Smartlog = defaultLogger) {
|
||||
// what happens here that a instance of this class will have instance.logger available
|
||||
// if you set a custom logger, than that will be used, if not the default logger.
|
||||
Logging is straightforward; you can log messages at various levels such as `info`, `warn`, `error`, `silly`, etc.:
|
||||
|
||||
```typescript
|
||||
logger.log('info', 'This is an info message');
|
||||
logger.log('error', 'This is an error message with details', { errorCode: 123 });
|
||||
```
|
||||
|
||||
The logging method accepts additional data as the third parameter, allowing you to attach more context to each log message, which is immensely useful for debugging.
|
||||
|
||||
### Using the Default Logger
|
||||
|
||||
For convenience, `@push.rocks/smartlog` provides a default logger that you can use out of the box:
|
||||
|
||||
```typescript
|
||||
import { defaultLogger } from '@push.rocks/smartlog';
|
||||
|
||||
defaultLogger.log('warn', 'This is a warning message using the default logger');
|
||||
```
|
||||
|
||||
This is particularly helpful for simple applications or for initial project setup.
|
||||
|
||||
### Extending With Log Destinations
|
||||
|
||||
One of the core strengths of `@push.rocks/smartlog` is its ability to work with multiple log destinations, enabling you to log messages not just to the console but also to external logging services or custom destinations.
|
||||
|
||||
To add a log destination, you create a class that implements the `ILogDestination` interface and then add it to the logger:
|
||||
|
||||
```typescript
|
||||
import { Smartlog, ILogDestination } from '@push.rocks/smartlog';
|
||||
|
||||
class MyCustomLogDestination implements ILogDestination {
|
||||
async handleLog(logPackage) {
|
||||
// Implement your custom logging logic here
|
||||
console.log(`Custom log: ${logPackage.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
const logger = new Smartlog({ logContext: { /* your context */ } });
|
||||
logger.addLogDestination(new MyCustomLogDestination());
|
||||
```
|
||||
|
||||
### Destinations
|
||||
After adding your custom log destination(s), every log message sent through `Smartlog` will also be routed to them according to their implementation.
|
||||
|
||||
smartlog supports different kinds of destinations.
|
||||
### Integration with Logging Services
|
||||
|
||||
The following destinations are available:
|
||||
`@push.rocks/smartlog` is designed to be extensible; you can integrate it with various logging services like Scalyr, Elasticsearch, LogDNA, etc., by developing or using existing log destinations conforming to those services.
|
||||
|
||||
- [@pushrocks/smartlog-destination-local](https://www.npmjs.com/package/@pushrocks/smartlog-destination-local) - outputs logs to the local console in a colorful, nice to read way.
|
||||
- [@pushrocks/smartlog-destination-devtools](https://www.npmjs.com/package/@pushrocks/smartlog-destination-devtools) - outputs logs into the browser console in a colorful, nice to read way.
|
||||
- [@pushrocks/smartlog-destination-receiver](https://www.npmjs.com/package/@pushrocks/smartlog-destination-receiver) - sends logs to a smartlog receiver (more about that below)
|
||||
- [@mojoio/scalyr](https://www.npmjs.com/package/@pushrocks/smartlog-destination-receiver) - an scalyr API package that comes with a smartlog log destination included
|
||||
- [@mojoio/elasticsearch](https://www.npmjs.com/package/@mojoio/elasticsearch) - an elasticsearch API package that comes with a smartlog destination included
|
||||
Check the npm registry or GitHub for community-contributed log destinations that can seamlessly integrate `@push.rocks/smartlog` into your preferred logging infrastructure.
|
||||
|
||||
### Adding a log destination
|
||||
### Advanced Usage
|
||||
|
||||
```
|
||||
// TBD
|
||||
```
|
||||
- **Log Groups**: You can use log groups to associate related log messages, which is especially handy for tracking logs across distributed systems.
|
||||
- **Custom Log Levels**: Beyond the standard log levels, you can define custom log levels that suit your project needs.
|
||||
- **Dynamic Log Contexts**: The log context can be dynamically adjusted to reflect different stages or aspects of your application logic.
|
||||
|
||||
## Contribution
|
||||
### Conclusion
|
||||
|
||||
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). :)
|
||||
`@push.rocks/smartlog` empowers you to implement a robust logging solution tailored to your needs with minimal effort. Its design promotes clarity, flexibility, and integration ease, making it an excellent choice for projects of any scale.
|
||||
|
||||
For further information read the linked docs at the top of this readme.
|
||||
Remember to refer to the official documentation and the type definitions for detailed information on all available methods and configurations. Happy logging!
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
## License and Legal Information
|
||||
|
||||
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user