Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
1xtr committed Apr 22, 2023
1 parent 4d83998 commit 43b53c6
Show file tree
Hide file tree
Showing 7 changed files with 2,024 additions and 33 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/npm-publish.yml
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}}
37 changes: 6 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.idea
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
Expand Down Expand Up @@ -42,8 +42,8 @@ build/Release
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo
Expand All @@ -54,9 +54,6 @@ web_modules/
# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
Expand All @@ -72,41 +69,29 @@ web_modules/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
# dotenv environment variables file
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

Expand All @@ -118,13 +103,3 @@ dist

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
72 changes: 70 additions & 2 deletions README.md
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
}
```
Loading

0 comments on commit 43b53c6

Please sign in to comment.