hubot 4.0.0 → 4.1.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/README.md CHANGED
@@ -18,4 +18,3 @@ are building your own bot. But if you do, check out [CONTRIBUTING.md](CONTRIBUTI
18
18
  ## License
19
19
 
20
20
  See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).
21
- `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hubot",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "author": "hubot",
5
5
  "keywords": [
6
6
  "github",
@@ -21,9 +21,8 @@
21
21
  "connect-multiparty": "^2.2.0",
22
22
  "express": "^4.18.2",
23
23
  "express-basic-auth": "^1.2.1",
24
- "log": "^6.3.1",
25
- "log-node": "^8.0.3",
26
- "optparse": "^1.0.5"
24
+ "optparse": "^1.0.5",
25
+ "pino": "^8.11.0"
27
26
  },
28
27
  "devDependencies": {
29
28
  "chai": "^4.3.7",
package/src/robot.js CHANGED
@@ -1,12 +1,10 @@
1
1
  'use strict'
2
- require('log-node')()
3
-
4
2
  const EventEmitter = require('events').EventEmitter
5
3
  const fs = require('fs')
6
4
  const path = require('path')
7
5
 
8
6
  const async = require('async')
9
- const log = require('log')
7
+ const pino = require('pino')
10
8
  const HttpClient = require('./httpclient')
11
9
 
12
10
  const Brain = require('./brain')
@@ -50,8 +48,15 @@ class Robot {
50
48
  response: new Middleware(this),
51
49
  receive: new Middleware(this)
52
50
  }
53
- process.env.LOG_LEVEL = process.env.LOG_LEVEL || process.env.HUBOT_LOG_LEVEL || 'info'
54
- this.logger = log.get('robot')
51
+ this.logger = pino({
52
+ name,
53
+ level: process.env.HUBOT_LOG_LEVEL || 'info'
54
+ })
55
+ Reflect.defineProperty(this.logger, 'warning', {
56
+ value: this.logger.warn,
57
+ enumerable: true,
58
+ configurable: true
59
+ })
55
60
 
56
61
  this.pingIntervalId = null
57
62
  this.globalHttpOptions = {}
@@ -6,7 +6,6 @@
6
6
  // Assertions and Stubbing
7
7
  const chai = require('chai')
8
8
  const sinon = require('sinon')
9
- const emitter = require('log/lib/emitter')
10
9
  chai.use(require('sinon-chai'))
11
10
 
12
11
  const expect = chai.expect
@@ -423,24 +422,15 @@ describe('Robot', function () {
423
422
  })
424
423
 
425
424
  it('logs a warning for a .js file', function () {
426
- let wasCalled = false
427
- const listener = e => {
428
- wasCalled = e.messageTokens.some(t => t.indexOf('Expected scripts/test-script') > -1)
429
- }
430
- emitter.on('log', listener)
425
+ sinon.stub(this.robot.logger, 'warning')
431
426
  this.robot.loadFile('./scripts', 'test-script.js')
432
- expect(wasCalled).to.be.true
433
- emitter.off('log', listener)
427
+ expect(this.robot.logger.warning).to.have.been.called
434
428
  })
435
429
 
436
430
  it('logs a warning for a .mjs file', function () {
437
- let wasCalled = false
438
- const listener = e => {
439
- wasCalled = e.messageTokens.some(t => t.indexOf('Expected scripts/test-script') > -1)
440
- }
441
- emitter.on('log', listener)
431
+ sinon.stub(this.robot.logger, 'warning')
442
432
  this.robot.loadFile('./scripts', 'test-script.mjs')
443
- expect(wasCalled).to.be.true
433
+ expect(this.robot.logger.warning).to.have.been.called
444
434
  })
445
435
  })
446
436