-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
2,024 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | ||
|
||
name: Node.js Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish-npm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm ci | ||
- run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,70 @@ | ||
# moleculer-universal-logger | ||
Send Moleculer logs to any endpoint (DataDog, LogTail, Newrelic, etc) | ||
<img src="https://moleculer.services/images/banner.png" alt="Moleculer_Logo" width="50%"/> | ||
|
||
[![NPM version](https://img.shields.io/npm/v/@1xtr/moleculer-universal-logger.svg)](https://www.npmjs.com/package/@1xtr/moleculer-universal-logger) ![NPM Downloads](https://img.shields.io/npm/dw/@1xtr/moleculer-universal-logger) | ||
|
||
## Send Moleculer logs to any endpoint (DataDog, LogTail, Newrelic, etc) | ||
|
||
### Description | ||
|
||
You can send Moleculer logs to any endpoint | ||
|
||
Log format: | ||
|
||
```json5 | ||
{ | ||
timestamp: 1682190435415, // Date.now() | ||
level: "info", // "fatal", "error", "warn", "info", "debug", "trace" | ||
message: "{}", // JSON.stringify of log args | ||
nodeID: "mol-repl_6428", // Unique node identifier | ||
namespace: "local", // Namespace of nodes to segment your nodes on the same network | ||
service: "repl", // service name | ||
source: "v1.repl", // broker, registry, discovery, transporter, cacher | ||
hostname: "linux", | ||
version: 1, // service version | ||
} | ||
``` | ||
|
||
### Install | ||
|
||
```bash | ||
$ npm install @1xtr/moleculer-universal-logger | ||
``` | ||
|
||
### Import | ||
|
||
```js | ||
// ES5 example | ||
const UniversalLogger = require('@1xtr/moleculer-universal-logger') | ||
|
||
// ES6+ example | ||
import { UniversalLogger } from '@1xtr/moleculer-universal-logger' | ||
``` | ||
|
||
### Usage | ||
|
||
```js | ||
module.exports = { | ||
logger: new UniversalLogger({ | ||
// put here your options | ||
url: 'https://log-api.eu.newrelic.com/log/v1?Api-Key=your_key' // newrelic EU | ||
}), | ||
} | ||
``` | ||
|
||
### Default options | ||
|
||
```js | ||
const defaultOptions = { | ||
url: process.env.UNIVERSAL_LOGGER_URL, | ||
fetchOptions: { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}, | ||
hostname: hostname(), | ||
objectPrinter: null, | ||
interval: 10 * 1000, | ||
excludeModules: [], // broker, registry, discovery, transporter, cacher | ||
} | ||
``` |
Oops, something went wrong.