-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
107f9f3
commit a49f313
Showing
5 changed files
with
26 additions
and
26 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
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
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 |
---|---|---|
|
@@ -43,7 +43,7 @@ Use the samples in the code block below as a starting point, and replace the sam | |
|
||
For a complete list of options, see the configuration parameters below the code block.👇 | ||
|
||
```js | ||
```javascript | ||
// Replace these parameters with your configuration | ||
var logger = require('logzio-nodejs').createLogger({ | ||
token: '<<LOG-SHIPPING-TOKEN>>', | ||
|
@@ -79,7 +79,7 @@ For more consistent and reliable parsing, we recommend sending logs as objects. | |
|
||
To send an object (recommended): | ||
|
||
```js | ||
```javascript | ||
var obj = { | ||
message: 'Some log message', | ||
param1: 'val1', | ||
|
@@ -90,21 +90,21 @@ To send an object (recommended): | |
|
||
To send raw text: | ||
|
||
```js | ||
```javascript | ||
logger.log('This is a log message'); | ||
``` | ||
|
||
Include this line at the end of the run if you're using logzio-nodejs in a severless environment, such as AWS Lambda, Azure Functions, or Google Cloud Functions: | ||
|
||
```js | ||
```javascript | ||
logger.sendAndClose(); | ||
``` | ||
|
||
###### Custom tags | ||
|
||
You can add custom tags to your logs using the following format: `{ tags : ['tag1']}`, for example: | ||
|
||
```js | ||
```javascript | ||
var obj = { | ||
|
||
message: 'Your log message', | ||
|
@@ -143,7 +143,7 @@ npm install winston-logzio --save | |
Here's a sample configuration that you can use as a starting point. | ||
Use the samples in the code block below or replace the sample with a configuration that matches your needs. | ||
|
||
```js | ||
```javascript | ||
const winston = require('winston'); | ||
const LogzioWinstonTransport = require('winston-logzio'); | ||
|
||
|
@@ -196,24 +196,24 @@ For a complete list of your options, see the configuration parameters below.👇 | |
|
||
* If winston-logzio is used as part of a serverless service (AWS Lambda, Azure Functions, Google Cloud Functions, etc.), add this line at the end of the configuration code block. | ||
|
||
```js | ||
```javascript | ||
logger.close() | ||
``` | ||
|
||
* The winston logger by default sends all logs to the console. You can easily disable this by adding this line to your code: | ||
|
||
```js | ||
```javascript | ||
winston.remove(winston.transports.Console); | ||
``` | ||
* To send a log line: | ||
|
||
```js | ||
```javascript | ||
winston.log('info', 'winston logger configured with logzio transport'); | ||
``` | ||
|
||
* To log the last UncaughtException before Node exits: | ||
|
||
```js | ||
```javascript | ||
var logzIOTransport = new (winstonLogzIO)(loggerOptions); | ||
var logger = new(winston.Logger)({ | ||
transports: [ | ||
|
@@ -235,7 +235,7 @@ For a complete list of your options, see the configuration parameters below.👇 | |
|
||
* Another configuration option | ||
|
||
```js | ||
```javascript | ||
var winston = require('winston'); | ||
var logzioWinstonTransport = require('winston-logzio'); | ||
|
||
|
@@ -255,7 +255,7 @@ For a complete list of your options, see the configuration parameters below.👇 | |
|
||
You can add custom tags to your logs using the following format: `{ tags : ['tag1']}`, for example: | ||
|
||
```js | ||
```javascript | ||
var obj = { | ||
|
||
message: 'Your log message', | ||
|
@@ -295,13 +295,13 @@ npm install winston-logzio --save | |
|
||
If you don't have a `tsconfig.json` file, you'll need to add it first. Start by running: | ||
|
||
```js | ||
```javascript | ||
tsc --init | ||
``` | ||
|
||
On your `tsconfig.json` file, under the parameter `compilerOptions` make sure you have the `esModuleInterop` flag set to `true` or add it: | ||
|
||
```js | ||
```javascript | ||
"compilerOptions": { | ||
... | ||
"esModuleInterop": true | ||
|
@@ -311,7 +311,7 @@ On your `tsconfig.json` file, under the parameter `compilerOptions` make sure yo | |
Here's a sample configuration that you can use as a starting point. | ||
Use the samples in the code block below or replace the sample with a configuration that matches your needs. | ||
|
||
```js | ||
```javascript | ||
import winston from 'winston'; | ||
import LogzioWinstonTransport from 'winston-logzio'; | ||
const logzioWinstonTransport = new LogzioWinstonTransport({ | ||
|
@@ -329,7 +329,7 @@ logger.log('warn', 'Just a test message'); | |
|
||
If winston-logzio is used as part of a serverless service (AWS Lambda, Azure Functions, Google Cloud Functions, etc.), add this line at the end of the configuration code block, every time you are using the logger. | ||
|
||
```js | ||
```javascript | ||
await logger.info(“API Called”) | ||
|
||
logger.close() | ||
|
@@ -357,7 +357,7 @@ tsc --project tsconfig.json | |
|
||
You can add custom tags to your logs using the following format: `{ tags : ['tag1']}`, for example: | ||
|
||
```js | ||
```javascript | ||
var obj = { | ||
|
||
message: 'Your log message', | ||
|
@@ -400,7 +400,7 @@ npm install [email protected] | |
|
||
Add the following code to your application: | ||
|
||
```js | ||
```javascript | ||
const MeterProvider = require('@opentelemetry/sdk-metrics-base'); | ||
const sdk = require('logzio-nodejs-metrics-sdk'); | ||
|
||
|
@@ -441,7 +441,7 @@ To add a required metric to your code, copy and paste the required metric code t | |
|
||
#### Counter | ||
|
||
```js | ||
```javascript | ||
// Create your first counter metric | ||
const requestCounter = meter.createCounter('Counter', { | ||
description: 'Example of a Counter', | ||
|
@@ -456,7 +456,7 @@ requestCounter.add(1,labels); | |
|
||
#### UpDownCounter | ||
|
||
```js | ||
```javascript | ||
// Create UpDownCounter metric | ||
const upDownCounter = meter.createUpDownCounter('UpDownCounter', { | ||
description: 'Example of a UpDownCounter', | ||
|
@@ -472,7 +472,7 @@ upDownCounter.add(-1,labels); | |
|
||
#### Histogram: | ||
|
||
```js | ||
```javascript | ||
// Create ValueRecorder metric | ||
const histogram = meter.createHistogram('test_histogram', { | ||
description: 'Example of a histogram', | ||
|