mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-23 18:43:21 +00: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`
|
||||
fetch.fetch(uri,options).then(res => res.text()).then(body => {
|
||||
console.log("About to parse Int", body)
|
||||
if (parseInt(body) > Date.now()) {
|
||||
console.log("About to set logger level to trace")
|
||||
console.log(this.logger)
|
||||
this.logger.level('trace')
|
||||
} else {
|
||||
console.log("About to set logger level to default")
|
||||
this.logger.level(this.defaultLevel)
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log("ERROR: About to set logger level to default")
|
||||
this.logger.level(this.defaultLevel)
|
||||
return
|
||||
})
|
||||
|
|
|
@ -30,7 +30,9 @@ describe('LoggingManager', function () {
|
|||
once: sinon.stub().yields()
|
||||
}
|
||||
this.fetchResponse = {
|
||||
text: sinon.stub().resolves('')
|
||||
text: sinon.stub().resolves(''),
|
||||
status: 200,
|
||||
ok: true
|
||||
}
|
||||
this.Bunyan = {
|
||||
createLogger: sinon.stub().returns(this.bunyanLogger),
|
||||
|
@ -439,11 +441,14 @@ describe('LoggingManager', function () {
|
|||
describe('when level is already set', function() {
|
||||
beforeEach(function() {
|
||||
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()
|
||||
})
|
||||
|
||||
it('should set trace level', function() {
|
||||
it.only('should set trace level', function() {
|
||||
this.bunyanLogger.level.should.have.been.calledOnce.and.calledWith(
|
||||
'trace'
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue