gloriaJun / gloria-libs

for developing research and my frequent library packages
MIT License
1 stars 0 forks source link

feat: add logger package #22

Closed gloriaJun closed 3 years ago

gloriaJun commented 3 years ago

What is this PR?

Test Scenario

❯ yarn test:logger
yarn run v1.22.10
$ lerna --scope=@glibs/logger exec -- yarn run test
lerna notice cli v3.22.1
lerna info versioning independent
lerna notice filter including "@glibs/logger"
lerna info filter [ '@glibs/logger' ]
lerna info Executing command in 1 package: "yarn run test"
$ jest --verbose --colors
 PASS   @glibs/logger  src/logger.spec.ts
  Logger
    ✓ should be set log level info, if not set level (2 ms)
    ✓ should be set log level info, if set level (1 ms)
    should be print message property
      ✓ simple string message (18 ms)
    should be call by the log level
      ✓ [trace] should be call the trace logging (2 ms)
      should be call by the log level
        ✓ [debug] should be not call the trace logging
        ✓ [debug] should be call the debug logging (1 ms)

  console.log
    ### will be logging 3 3

      at Logger.log (src/logger.ts:28:15)

  console.info
    logging message

      at console.<anonymous> (../../node_modules/jest-mock/build/index.js:845:25)

  console.log
    ### will be logging 1 1

      at Logger.log (src/logger.ts:28:15)

  console.error
    Trace: message
        at console.<anonymous> (/Volumes/data/mio/gloria-libs/node_modules/jest-mock/build/index.js:845:25)
        at /Volumes/data/mio/gloria-libs/node_modules/jest-mock/build/index.js:444:39
        at console.<anonymous> (/Volumes/data/mio/gloria-libs/node_modules/jest-mock/build/index.js:452:13)
        at console.mockConstructor [as trace] (/Volumes/data/mio/gloria-libs/node_modules/jest-mock/build/index.js:166:19)
        at Logger.log (/Volumes/data/mio/gloria-libs/packages/logger/src/logger.ts:30:19)
        at Logger.trace (/Volumes/data/mio/gloria-libs/packages/logger/src/logger.ts:39:13)
        at Object.<anonymous> (/Volumes/data/mio/gloria-libs/packages/logger/src/logger.spec.ts:42:14)
        at Object.asyncJestTest (/Volumes/data/mio/gloria-libs/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
        at /Volumes/data/mio/gloria-libs/node_modules/jest-jasmine2/build/queueRunner.js:45:12
        at new Promise (<anonymous>)

      at console.<anonymous> (../../node_modules/jest-mock/build/index.js:845:25)

  console.log
    ### will be logging 2 2

      at Logger.log (src/logger.ts:28:15)

  console.debug
    message

      at console.<anonymous> (../../node_modules/jest-mock/build/index.js:845:25)

-----------|---------|----------|---------|---------|-------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-----------|---------|----------|---------|---------|-------------------
All files  |    87.1 |      100 |   77.78 |   91.67 |                   
 logger.ts |    87.1 |      100 |   77.78 |   91.67 | 51,55             
-----------|---------|----------|---------|---------|-------------------
Test Suites: 1 passed, 1 total
Tests:       6 passed, 6 total
Snapshots:   0 total
Time:        1.329 s, estimated 4 s
Ran all test suites.
lerna success exec Executed command in 1 package: "yarn run test"
✨  Done in 3.38s.

Related Issue

commit-lint[bot] commented 3 years ago

Chore

Features

Bug Fixes

Contributors

gloriaJun

Commit-Lint commands
You can trigger Commit-Lint actions by commenting on this PR: - `@Commit-Lint merge patch` will merge dependabot PR on "patch" versions (X.X.Y - Y change) - `@Commit-Lint merge minor` will merge dependabot PR on "minor" versions (X.Y.Y - Y change) - `@Commit-Lint merge major` will merge dependabot PR on "major" versions (Y.Y.Y - Y change) - `@Commit-Lint merge disable` will desactivate merge dependabot PR - `@Commit-Lint review` will approve dependabot PR - `@Commit-Lint stop review` will stop approve dependabot PR