3.0.0-beta.15 • Published 1 year ago
newsource-winston-splunk-logger v3.0.0-beta.15
Overview
Custom logging module that wraps winston 3.x
Installation
npm install --save newsource-winston-splunk-logger
Setup
import createLogger from "newsource-winston-splunk-logger";
// Minimum required configuration
const config = {
"appName": string
}
const loggerInstance = createLogger(config);
The LoggerConfig and other main types are located in one of:
dist/cjs/types/types.d.ts
dist/esm/types/types.d.ts
Configuration
Splunk (optional)
const config = {
appName: 'winston-splunk-logger-application',
splunk: {
index: 'winston-index',
level: 'silly', //optional
source: 'winston-environment',
sourcetype: 'winston-splunk-logger',
token: '123456789',
url: 'https://splunk.local:8088',
}
}
Email (optional)
const config = {
appName: 'winston-splunk-logger-application',
email: {
host: 'smtp.local.com',
port: 2000,
from: 'test@local.com',
to: 'test@local.com',
}
}
File logging (optional)
const config = {
appName: 'winston-splunk-logger-application',
file: {
dirname: 'logs',
filename: 'application',
maxFiles: 10,
maxSize: 1000000
},
}
Cloudwatch logging formatted for mssnews-cloudwatch-log-forwarder
const config = {
appName: 'winston-splunk-logger-application',
formatForForwarding: true
}
Custom log levels (optional)
This is for overriding or adding custom log levels.
const config = {
appName: 'winston-splunk-logger-application',
levels:{
mycustomlevel1: -1,
mycustomlevel2: -2,
mycustomlevel3: -3
}
}
Full example
const config = {
appName: 'newsource-winston-splunk-logger',
env: 'dev', // Used in subject like of Email logger
formatForForwarding: false,
level: 'silly', // Log level, defaults to silly
levels:{ // Custom levels (optional)
mycustomlevel1: -1,
mycustomlevel2: -2,
mycustomlevel3: -3
},
email: {
host: 'smtp.local.com',
port: 2000,
from: 'test@local.com',
to: 'test@local.com',
},
file: {
dirname: 'logs', // Directory for log files
filename: 'application', // Name prefix of log files
maxFiles: 10, // Max number of files
maxSize: 1000000 // In bytes
},
splunk: {
index: 'splunk-group',
source: 'splunk-environment',
sourcetype: 'application-name',
token: '123456789-123-123456',
url: 'https://splunk.example.com:2000',
}
}
3.0.0-beta.1
1 year ago
3.0.0-beta.3
1 year ago
3.0.0-beta.2
1 year ago
3.0.0-beta.4
1 year ago
3.0.0-beta.7
1 year ago
3.0.0-beta.6
1 year ago
3.0.0-beta.9
1 year ago
3.0.0-beta.8
1 year ago
3.0.0-beta.10
1 year ago
3.0.0-beta.11
1 year ago
3.0.0-beta.12
1 year ago
3.0.0-beta.13
1 year ago
3.0.0-beta.14
1 year ago
3.0.0-beta.15
1 year ago
2.1.4
2 years ago
2.1.3
2 years ago
2.1.2
3 years ago
2.1.1
3 years ago
2.1.0
5 years ago
2.0.0
5 years ago
1.0.20
5 years ago
1.0.19
5 years ago
1.0.18
5 years ago
1.0.17
6 years ago
1.0.16
6 years ago
1.0.15
6 years ago
1.0.14
7 years ago
1.0.13
7 years ago
1.0.12
7 years ago
1.0.11
7 years ago
1.0.10
7 years ago
1.0.9
7 years ago
1.0.8
7 years ago
1.0.7
7 years ago
1.0.6
7 years ago
1.0.5
7 years ago
1.0.4
7 years ago
1.0.3
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago