mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
WIP
This commit is contained in:
parent
14bac39222
commit
6b8dd86a26
2 changed files with 13 additions and 3 deletions
|
@ -64,12 +64,17 @@ const Logger = (module.exports = {
|
||||||
}
|
}
|
||||||
const uri = `http://metadata.google.internal/computeMetadata/v1/project/attributes/${this.loggerName}-setLogLevelEndTime`
|
const uri = `http://metadata.google.internal/computeMetadata/v1/project/attributes/${this.loggerName}-setLogLevelEndTime`
|
||||||
fetch.fetch(uri,options).then(res => res.text()).then(body => {
|
fetch.fetch(uri,options).then(res => res.text()).then(body => {
|
||||||
|
console.log("About to parse Int", body)
|
||||||
if (parseInt(body) > Date.now()) {
|
if (parseInt(body) > Date.now()) {
|
||||||
|
console.log("About to set logger level to trace")
|
||||||
|
console.log(this.logger)
|
||||||
this.logger.level('trace')
|
this.logger.level('trace')
|
||||||
} else {
|
} else {
|
||||||
|
console.log("About to set logger level to default")
|
||||||
this.logger.level(this.defaultLevel)
|
this.logger.level(this.defaultLevel)
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
console.log("ERROR: About to set logger level to default")
|
||||||
this.logger.level(this.defaultLevel)
|
this.logger.level(this.defaultLevel)
|
||||||
return
|
return
|
||||||
})
|
})
|
||||||
|
|
|
@ -30,7 +30,9 @@ describe('LoggingManager', function () {
|
||||||
once: sinon.stub().yields()
|
once: sinon.stub().yields()
|
||||||
}
|
}
|
||||||
this.fetchResponse = {
|
this.fetchResponse = {
|
||||||
text: sinon.stub().resolves('')
|
text: sinon.stub().resolves(''),
|
||||||
|
status: 200,
|
||||||
|
ok: true
|
||||||
}
|
}
|
||||||
this.Bunyan = {
|
this.Bunyan = {
|
||||||
createLogger: sinon.stub().returns(this.bunyanLogger),
|
createLogger: sinon.stub().returns(this.bunyanLogger),
|
||||||
|
@ -439,11 +441,14 @@ describe('LoggingManager', function () {
|
||||||
describe('when level is already set', function() {
|
describe('when level is already set', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
this.bunyanLogger.level.returns(10)
|
this.bunyanLogger.level.returns(10)
|
||||||
this.Request.yields(null, { statusCode: 200 }, this.start + 1000)
|
//this.Request.yields(null, { statusCode: 200 }, this.start + 1000)
|
||||||
|
console.log("In test ", this.start + 1000)
|
||||||
|
this.fetchResponse.text = sinon.stub().resolves(this.start + 1000)
|
||||||
|
this.Fetch.fetch = sinon.stub().resolves(this.fetchResponse)
|
||||||
this.logger.checkLogLevel()
|
this.logger.checkLogLevel()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should set trace level', function() {
|
it.only('should set trace level', function() {
|
||||||
this.bunyanLogger.level.should.have.been.calledOnce.and.calledWith(
|
this.bunyanLogger.level.should.have.been.calledOnce.and.calledWith(
|
||||||
'trace'
|
'trace'
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue