@itleanchatbot/shared-models-js-postgres 1.0.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.
package/LICENSE.md ADDED
File without changes
package/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # Logger #
2
+
3
+ O pacote da Itlean para logs é uma abstração para a geração de logs de sistema, como console e file log.
4
+
5
+ ## External dependencies ##
6
+
7
+ Usamos o log4js para gerar os logs dentro da camada abstrata
8
+ <https://www.npmjs.com/package/log4js>
9
+
10
+ ## Methods usages ##
11
+
12
+ ~~~javascript
13
+ // pass - LOGGER_LEVEL, LOGGER_TYPE, LOGGER_FILE
14
+ const logger = Factory.getLogger('debug', 'console', '')
15
+ ~~~
16
+
17
+ * Debug
18
+
19
+ ~~~javascript
20
+ logger.debug('example debug', [ { param: 'debug' } ])
21
+ /*
22
+ Result
23
+
24
+ [2020-09-18T15:59:00.293] [DEBUG] default - example debug [ { param: 'debug' } ]
25
+ */
26
+ ~~~
27
+
28
+ * Info
29
+
30
+ ~~~javascript
31
+ logger.info('example info', [ { param: 'info' } ])
32
+ /*
33
+ Result
34
+
35
+ [2020-09-18T15:59:00.306] [INFO] default - example info [ { param: 'info' } ]
36
+ */
37
+ ~~~
38
+
39
+ * Warn
40
+
41
+ ~~~javascript
42
+ logger.warning('example warning', [ { param: 'warning' } ])
43
+ /*
44
+ Result
45
+
46
+ [2020-09-18T15:59:00.307] [WARN] default - example warning [ { param: 'warning' } ]
47
+ */
48
+ ~~~
49
+
50
+ * Error
51
+
52
+ ~~~javascript
53
+ logger.error('example error', [ { param: 'error' } ])
54
+ /*
55
+ Result
56
+
57
+ [2020-09-18T15:59:00.307] [ERROR] default - example error [ { param: 'error' } ]
58
+ */
59
+ ~~~
60
+
61
+ * Exception
62
+
63
+ ~~~javascript
64
+ logger.exception(new Error('example exception'))
65
+ /*
66
+ Result
67
+
68
+ [2020-09-18T15:59:00.308] [ERROR] default - example exception Error: test to exception
69
+ at Object.it (D:\dev\itlean\packages\logger\test\logger.test.ts:56:19)
70
+ at Object.asyncJestTest (D:\dev\itlean\packages\logger\node_modules\jest-jasmine2\build\jasmineAsyncInstall.js:106:37)
71
+ at resolve (D:\dev\itlean\packages\logger\node_modules\jest-jasmine2\build\queueRunner.js:45:12)
72
+ at new Promise (<anonymous>)
73
+ at mapper (D:\dev\itlean\packages\logger\node_modules\jest-jasmine2\build\queueRunner.js:28:19)
74
+ at promise.then (D:\dev\itlean\packages\logger\node_modules\jest-jasmine2\build\queueRunner.js:75:41)
75
+ at process._tickCallback (internal/process/next_tick.js:68:7)
76
+ */
77
+
78
+ // usages
79
+
80
+ try {
81
+ const db = new Connection() // throw if fail connection
82
+ }
83
+ catch(e) {
84
+ logger.exception(e)
85
+ }
86
+ ~~~
package/index.js ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@itleanchatbot/shared-models-js-postgres",
3
+ "version": "1.0.0",
4
+ "description": "Shared Models JS Postgres",
5
+ "main": "index.js",
6
+ "license": "ISC",
7
+ "author": "Wilber da Silva <wilber.costa@itlean.com>",
8
+ "scripts": {
9
+ "lint": "npx eslint \"{src,apps,libs,test}/**/*.js\" --fix",
10
+ "format": "npm run format:src",
11
+ "format:src": "npx prettier --write \"src/**/*.js\""
12
+ },
13
+ "husky": {
14
+ "hooks": {
15
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
16
+ "prepare-commit-msg": "exec < /dev/tty && git cz --hook || true"
17
+ }
18
+ },
19
+ "config": {
20
+ "commitizen": {
21
+ "path": "./node_modules/cz-conventional-changelog"
22
+ }
23
+ },
24
+ "devDependencies": {
25
+ "@commitlint/cli": "^11.0.0",
26
+ "@commitlint/config-conventional": "^11.0.0",
27
+ "commitizen": "^4.2.2",
28
+ "cz-conventional-changelog": "^3.3.0",
29
+ "eslint": "^7.15.0",
30
+ "eslint-config-airbnb-base": "^14.2.1",
31
+ "eslint-config-prettier": "^7.0.0",
32
+ "eslint-config-standard": "^16.0.2",
33
+ "eslint-plugin-prettier": "^3.3.0",
34
+ "eslint-plugin-promise": "^4.2.1",
35
+ "husky": "^4.3.6",
36
+ "jest": "^26.6.3",
37
+ "prettier": "^2.2.1"
38
+ },
39
+ "dependencies": {}
40
+ }