From 093055b413ffc5be58a9b8e1837a73ca6218205b Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sun, 14 Apr 2024 17:49:32 +0200 Subject: [PATCH] update tsconfig --- npmextra.json | 18 ++++++-- package.json | 30 ++++++++++---- readme.hints.md | 1 + readme.md | 108 ++++++++++++++++++++++++++++++++++++------------ 4 files changed, 118 insertions(+), 39 deletions(-) create mode 100644 readme.hints.md diff --git a/npmextra.json b/npmextra.json index 755c96d..c6953bd 100644 --- a/npmextra.json +++ b/npmextra.json @@ -5,17 +5,29 @@ "githost": "code.foss.global", "gitscope": "push.rocks", "gitrepo": "smartlog-destination-clickhouse", - "description": "a smartlog destination pushing logs to clickhouse", + "description": "A library to integrate Smartlog logging with ClickHouse database for efficient log storage and querying.", "npmPackagename": "@push.rocks/smartlog-destination-clickhouse", "license": "MIT", - "projectDomain": "push.rocks" + "projectDomain": "push.rocks", + "keywords": [ + "logging", + "clickhouse", + "smartlog", + "log management", + "database integration", + "typescript", + "real-time logging", + "structured logging", + "log storage", + "log querying" + ] } }, "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" } } \ No newline at end of file diff --git a/package.json b/package.json index 49ab67d..cc9dcb2 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@push.rocks/smartlog-destination-clickhouse", "version": "1.0.11", "private": false, - "description": "a smartlog destination pushing logs to clickhouse", + "description": "A library to integrate Smartlog logging with ClickHouse database for efficient log storage and querying.", "main": "dist_ts/index.js", "typings": "dist_ts/index.d.ts", "type": "module", @@ -14,16 +14,16 @@ "buildDocs": "(tsdoc)" }, "devDependencies": { - "@gitzone/tsbuild": "^2.1.65", - "@gitzone/tsbundle": "^2.0.7", - "@gitzone/tsdoc": "^1.1.10", - "@gitzone/tstest": "^1.0.73", - "@pushrocks/tapbundle": "^5.0.3", - "@types/node": "^18.6.4" + "@git.zone/tsbuild": "^2.1.66", + "@git.zone/tsbundle": "^2.0.8", + "@git.zone/tsrun": "^1.2.46", + "@git.zone/tstest": "^1.0.77", + "@push.rocks/tapbundle": "^5.0.8", + "@types/node": "^20.11.16" }, "dependencies": { - "@pushrocks/smartclickhouse": "^2.0.14", - "@pushrocks/smartlog-interfaces": "^2.0.23" + "@push.rocks/smartclickhouse": "^2.0.14", + "@push.rocks/smartlog-interfaces": "^3.0.0" }, "browserslist": [ "last 1 chrome versions" @@ -39,5 +39,17 @@ "cli.js", "npmextra.json", "readme.md" + ], + "keywords": [ + "logging", + "clickhouse", + "smartlog", + "log management", + "database integration", + "typescript", + "real-time logging", + "structured logging", + "log storage", + "log querying" ] } \ No newline at end of file diff --git a/readme.hints.md b/readme.hints.md new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/readme.hints.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/readme.md b/readme.md index a0e7070..c0a93ca 100644 --- a/readme.md +++ b/readme.md @@ -1,39 +1,93 @@ -# @pushrocks/smartlog-destination-clickhouse +# @push.rocks/smartlog-destination-clickhouse a smartlog destination pushing logs to clickhouse -## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartlog-destination-clickhouse) -* [gitlab.com (source)](https://gitlab.com/pushrocks/smartlog-destination-clickhouse) -* [github.com (source mirror)](https://github.com/pushrocks/smartlog-destination-clickhouse) -* [docs (typedoc)](https://pushrocks.gitlab.io/smartlog-destination-clickhouse/) +## Install +To start using `@push.rocks/smartlog-destination-clickhouse`, you need to install it using npm (Node Package Manager). Run the following command in your terminal: -## Status for master +```bash +npm install @push.rocks/smartlog-destination-clickhouse --save +``` -Status Category | Status Badge --- | -- -GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartlog-destination-clickhouse/badges/master/pipeline.svg)](https://lossless.cloud) -GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartlog-destination-clickhouse/badges/master/coverage.svg)](https://lossless.cloud) -npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartlog-destination-clickhouse)](https://lossless.cloud) -Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartlog-destination-clickhouse)](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-destination-clickhouse)](https://lossless.cloud) -PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartlog-destination-clickhouse)](https://lossless.cloud) -BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartlog-destination-clickhouse)](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 will download the package and add it as a dependency to your project's `package.json` file. ## Usage -Use TypeScript for best in class intellisense +`@push.rocks/smartlog-destination-clickhouse` enables your applications to push logs directly to a ClickHouse database. This can be extremely useful for applications needing to log large amounts of data efficiently and perform complex analytics on logged data. -## Contribution +To get started, you'll first need to import the necessary modules and initialize the smartlog destination for ClickHouse. Here's a step-by-step guide using TypeScript with ESM syntax: -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). :) +### Step 1: Import Modules -For further information read the linked docs at the top of this readme. +First, you need to import the `SmartlogDestinationClickhouse` class from the package: -> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) +```typescript +import { SmartlogDestinationClickhouse } from '@push.rocks/smartlog-destination-clickhouse'; +``` -[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) +### Step 2: Initialize Smartlog Destination + +Before you can push logs to ClickHouse, you need to create an instance of `SmartlogDestinationClickhouse` and start it. This involves providing configuration details for your ClickHouse instance. + +```typescript +// Define ClickHouse configuration +const clickhouseConfig = { + host: 'your_clickhouse_host', + port: 8123, // default ClickHouse HTTP interface port + db: 'your_database_name', + user: 'your_clickhouse_user', + password: 'your_clickhouse_password', +}; + +// Create and start the SmartlogDestinationClickhouse instance +const smartlogDestination = await SmartlogDestinationClickhouse.createAndStart(clickhouseConfig); +``` + +This setup initializes the connection to your ClickHouse database and prepares it for logging. + +### Step 3: Log Handling + +Now that the setup is complete, you can start handling logs. The `handleLog` method provided by `SmartlogDestinationClickhouse` allows you to push log packages to your ClickHouse database. + +```typescript +import { ILogPackage } from '@push.rocks/smartlog-interfaces'; + +// Sample log package +const sampleLogPackage: ILogPackage = { + logLevel: 'info', + message: 'This is a test log message', + additionalData: { + // Any additional data you wish to log + key: 'value' + } +}; + +// Handle log +await smartlogDestination.handleLog(sampleLogPackage); +``` + +This will push the log to your ClickHouse database, making it available for querying and analysis. + +### Conclusion + +By following these steps, you can efficiently push logs to a ClickHouse database using `@push.rocks/smartlog-destination-clickhouse`. This setup provides a powerful and scalable logging solution for modern applications, enabling complex analytics on logged data. + +Remember to always manage your database connections responsibly and ensure you have appropriate logging levels and data retention policies in place to avoid overwhelming your database with excessive logging data. + +## 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.