@mimik/sumologic-winston-logger 2.1.13 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,138 +0,0 @@
1
-
2
- ## Synopsis ##
3
-
4
- Sumologic-Winston-Logger is a log wrapper that can write to multiple logging services.
5
- Currently, Winston, SumoLogic, AWS Kinesis and AWS S3 are supported.
6
- The package also adds stackTrace info.
7
- StackTrace information is included in all log entries. For error-level logs, the full stack trace is added. For other log levels, method name, file name, and line number are appended. **Line formatting is not currently configurable.**
8
- The package also allows some level of filtering.
9
-
10
- ## Motivation ##
11
- To centralize logging in a single npm node package
12
-
13
- ## Installation ##
14
-
15
- The logger is discoverable on npmjs.org.
16
-
17
- To install:
18
- ```
19
- npm install @mimik/sumologic-winston-logger --save
20
- ```
21
-
22
- ## Configuration - Details ##
23
-
24
- The following sections describe the details of each of the environment variables listed above.
25
-
26
- ### `LOG_LEVEL` ###
27
- Log levels supported inclusively according to the following list, as borrowed from winston:
28
-
29
- * silly
30
- * verbose
31
- * debug
32
- * info
33
- * warn
34
- * error
35
-
36
- Thus, if one declares a log level of silly, the levels error, warn, info, debug, and verbose are reported too.
37
-
38
- |Example to set the environment variable `LOG_LEVEL`|
39
- |---|
40
- |`export LOG_LEVEL=error`|
41
-
42
- ### `SUMO_LOGIC_ENDPOINT` ###
43
- The endpoint defined in SumoLogic to where log information will be sent. See the section, _Finding SumoLogic endpoint and collector code_, below to find the value to assign to this environment variable.
44
-
45
- |Example to set the environment variable `SUMO_LOGIC_ENDPOINT`|
46
- |---|
47
- |`export SUMO_LOGIC_ENDPOINT=https://endpoint1.collection.us2.sumologic.com/receiver/v1/http/`|
48
-
49
- ### `SUMO_LOGIC_COLLECTOR_CODE` ###
50
- The collector code as defined in SumoLogic. The Collector Code is the Base64 string that appears after the last slash in the URL defined in the SumoLogic Control Panel.
51
-
52
- |Example to set the environment variable `SUMO_LOGIC_COLLECTOR_CODE`|
53
- |---|
54
- |`export SUMO_LOGIC_COLLECTOR_CODE=AhfheisdcOllectorCodeInSumoLogicuZw==`|
55
-
56
-
57
- To learn more about setting this environment variable, see the section, _Finding SumoLogic endpoint and collector code_, below.
58
-
59
- #### Finding SumoLogic endpoint and collector code ####
60
-
61
- To find the values that you will apply the environment variables, `SUMO_LOGIC_ENDPOINT` and `SUMO_LOGIC_COLLECTOR_CODE`, in the SumoLogic Control Panel, goto: Manage > Collection, and get the source category
62
-
63
- ![Screen Shot 2016-10-10 at 2.03.31 PM.png](https://bitbucket.org/repo/xbXGRo/images/3258406172-Screen%20Shot%202016-10-10%20at%202.03.31%20PM.png)
64
-
65
- **Figure 1: Select the Manage -> Collection to display a list of collectors in force**
66
-
67
-
68
- ![Screen Shot 2016-10-10 at 2.03.57 PM.png](https://bitbucket.org/repo/xbXGRo/images/1501199325-Screen%20Shot%202016-10-10%20at%202.03.57%20PM.png)
69
-
70
- **Figure 2: Click the link, Show URL to display the URL configuration for the given collector**
71
-
72
- ![Screen Shot 2016-10-10 at 2.04.18 PM.png](https://bitbucket.org/repo/xbXGRo/images/1913524258-Screen%20Shot%202016-10-10%20at%202.04.18%20PM.png)
73
-
74
- **Figure 3: The HTTP Source Address dialog shows collector's URL. The collector code is a Base64 string appended after the last slash in the Source Address URL**
75
-
76
- The endpoint is the part of the url that ends with a slash. i.e.
77
- `https://endpoint1.collection.us2.sumologic.com/receiver/v1/http/`
78
-
79
- The collector code is the Base64 encoded part of the URL that follows the last slash in the url.
80
-
81
- ### `FILTER_FILE` ###
82
-
83
- FILTER_FILE is the location where the definition of the filtering configuration is. The location has to be a full file name.
84
- When the environment (NODE_ENV) in which the logger is used is `prod` or `production`, the content of the log will be filtered according to the log filtering configuration included in the file referred by the FILTER_FILE variable.
85
- The filter will replace values of the designated property names to '-----'.
86
-
87
- ## Sample Use ##
88
-
89
- The intent of this package is to support all the behavior common to console.log while also including support of multiple arguments and all data types.
90
-
91
- Formatting console logs is left to winston, except that some stackTrace info is appended to each line.
92
-
93
- Formatting of SumoLogic logs is handled by this module in the following ways:
94
-
95
- * only the first argument is used as the message
96
- * only one object can be passed as parameter
97
- * structured stackTrace info is added to every log except when NO_STACK is set to 'yes'
98
- * if the last parameter is a string it will be considered as a `correlationId`
99
-
100
-
101
- ### Logging Examples ###
102
- Listing 2 below shows you how to declare a logger to run under ECMAScript 6 and then log using the various log levels supported by the Sumologic-Winston-Logger.
103
-
104
- ``` javascript
105
- import logger from '@mimik/sumologic-winston-logger';
106
-
107
- logger.log('debug', 'this is a debug statement using log');
108
- logger.debug({ message: 'this is a debug statement using an object'});
109
- logger.error('this is an error statement');
110
- logger.error(new Error('this is an error statement'));
111
- logger.warn('this is a warning statement', { meta: 'data' });
112
- logger.info('this is an info statement', { meta: 'data' });
113
- logger.verbose('this is a verbose statement');
114
- logger.silly('this is a silly statement o_O');
115
- logger.debug('this is a debug statement with 2 params', { meta: 'data' });
116
- logger.debug('this is a debug statement with 2 params and a correlationId', { meta: 'data' }, '123456')
117
- ```
118
- **Listing 2: Examples of using the logger to make a log entry, using the log levels, log, silly, verbose, debug, info, warn, and error**
119
-
120
- By default, log entries are logged to console.
121
- The log() method is also supported, and adds a level parameter in position 1.
122
-
123
- ### Tailing ###
124
-
125
- Tailing allows you to scroll through log output in real time. You can trail log data in SumoLogic.
126
-
127
- To trail in SumoLogic go to Search > Live Tail in the SumoLogic user interface and enter `sourceCategory=<source category>` in the search bar, where `<source category>` is the log you want to trail. Then click, Run
128
-
129
- |Example|
130
- |---|
131
- |`sourceCategory=local/node/challengeAPI/logs`|
132
-
133
- ### Stack Trace ###
134
- All calls to `error()` include the stack trace.
135
- All other log levels will include a line number and file name.
136
-
137
- ## License ##
138
- MIT
package/eslint.config.js DELETED
@@ -1,70 +0,0 @@
1
- import globals from 'globals';
2
- import importPlugin from 'eslint-plugin-import';
3
- import js from '@eslint/js';
4
- import processDoc from '@mimik/eslint-plugin-document-env';
5
- import stylistic from '@stylistic/eslint-plugin';
6
-
7
- const MAX_LENGTH_LINE = 180;
8
- const MAX_FUNCTION_PARAMETERS = 6;
9
- const MAX_LINES_IN_FILES = 600;
10
- const MAX_LINES_IN_FUNCTION = 150;
11
- const MAX_STATEMENTS_IN_FUNCTION = 45;
12
- const MIN_KEYS_IN_OBJECT = 10;
13
- const MAX_COMPLEXITY = 30;
14
- const ECMA_VERSION = 'latest';
15
- const MAX_DEPTH = 6;
16
- const ALLOWED_CONSTANTS = [0, 1, -1];
17
-
18
- export default [
19
- {
20
- ignores: ['coverage/**', 'mochawesome-report/**', 'node_modules/**', 'dist/**'],
21
- },
22
- importPlugin.flatConfigs.recommended,
23
- stylistic.configs.recommended,
24
- js.configs.all,
25
- {
26
- plugins: {
27
- processDoc,
28
- },
29
- languageOptions: {
30
- ecmaVersion: ECMA_VERSION,
31
- globals: {
32
- ...globals.mocha,
33
- ...globals.nodeBuiltin,
34
- },
35
- sourceType: 'module',
36
- },
37
- rules: {
38
- '@stylistic/brace-style': ['warn', 'stroustrup', { allowSingleLine: true }],
39
- '@stylistic/line-comment-position': ['off'],
40
- '@stylistic/max-len': ['warn', MAX_LENGTH_LINE, { ignoreComments: true, ignoreStrings: true, ignoreRegExpLiterals: true }],
41
- '@stylistic/quotes': ['warn', 'single'],
42
- '@stylistic/semi': ['error', 'always'],
43
- 'capitalized-comments': ['off'],
44
- 'complexity': ['error', MAX_COMPLEXITY],
45
- 'curly': ['off'],
46
- 'id-length': ['error', { exceptions: ['x', 'y', 'z', 'i', 'j', 'k'] }],
47
- 'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
48
- 'import/no-unresolved': ['error', { amd: true, caseSensitiveStrict: true, commonjs: true }],
49
- 'init-declarations': ['off'],
50
- 'linebreak-style': ['off'],
51
- 'max-depth': ['error', MAX_DEPTH],
52
- 'max-len': ['off'],
53
- 'max-lines': ['warn', { max: MAX_LINES_IN_FILES, skipComments: true, skipBlankLines: true }],
54
- 'max-lines-per-function': ['warn', { max: MAX_LINES_IN_FUNCTION, skipComments: true, skipBlankLines: true }],
55
- 'max-params': ['error', MAX_FUNCTION_PARAMETERS],
56
- 'max-statements': ['warn', MAX_STATEMENTS_IN_FUNCTION],
57
- 'no-confusing-arrow': ['off'],
58
- 'no-inline-comments': ['off'],
59
- 'no-magic-numbers': ['error', { ignore: ALLOWED_CONSTANTS, enforceConst: true, detectObjects: true }],
60
- 'no-process-env': ['error'],
61
- 'no-ternary': ['off'],
62
- 'no-undefined': ['off'],
63
- 'one-var': ['error', 'never'],
64
- 'processDoc/validate-document-env': ['error'],
65
- 'quotes': ['off'],
66
- 'sort-imports': ['error', { allowSeparatedGroups: true }],
67
- 'sort-keys': ['error', 'asc', { caseSensitive: true, minKeys: MIN_KEYS_IN_OBJECT, natural: false, allowLineSeparatedGroups: true }],
68
- },
69
- },
70
- ];
@@ -1,5 +0,0 @@
1
- [
2
- "$..references[0]",
3
- "$..references[1].serverType",
4
- "$..email"
5
- ]