lint and format

This commit is contained in:
Christopher Hoskin 2020-07-30 15:08:22 +01:00
parent 8376cf1ca2
commit 57ef07dc67
2 changed files with 7 additions and 8 deletions

View file

@ -22,7 +22,7 @@ const errSerializer = function (err) {
const Logger = (module.exports = {
initialize(name) {
console.log("IN INIT")
console.log('IN INIT')
this.logLevelSource = (process.env.LOG_LEVEL_SOURCE || 'file').toLowerCase()
this.isProduction =
(process.env.NODE_ENV || '').toLowerCase() === 'production'
@ -60,18 +60,18 @@ const Logger = (module.exports = {
},
async getTracingEndTimeFile() {
return fs.promises.readFile('/logging/tracingEndTime')
return fs.promises.readFile('/logging/tracingEndTime')
},
async getTracingEndTimeMetadata() {
async getTracingEndTimeMetadata() {
const options = {
headers: {
'Metadata-Flavor': 'Google'
}
}
const uri = `http://metadata.google.internal/computeMetadata/v1/project/attributes/${this.loggerName}-setLogLevelEndTime`
const res = await fetch(uri,options)
if (!res.ok) throw new Error("Metadata not okay")
const res = await fetch(uri, options)
if (!res.ok) throw new Error('Metadata not okay')
return res.text()
},
@ -256,7 +256,7 @@ async getTracingEndTimeMetadata() {
},
_setupLogLevelChecker() {
console.log("In _setupLogLevelChecker")
console.log('In _setupLogLevelChecker')
console.log(this.logger)
if (this.isProduction) {
// clear interval if already set
@ -266,7 +266,7 @@ async getTracingEndTimeMetadata() {
if (this.logLevelSource === 'file') {
this.getTracingEndTime = this.getTracingEndTimeFile
} else if (this.logLevelSource === 'gce_metadata') {
this.getTracingEndTime = this.getTracingEndTimeMetadata
this.getTracingEndTime = this.getTracingEndTimeMetadata
} else if (this.logLevelSource === 'none') {
return
} else {

View file

@ -4,7 +4,6 @@ const chai = require('chai')
const path = require('path')
const sinon = require('sinon')
const sinonChai = require('sinon-chai')
const { promises } = require('dns')
chai.use(sinonChai)
chai.should()