@@ -137,17 +137,16 @@ function getCurrentTraceFromAgent() {
137137 */
138138export class LoggingBunyan extends Writable {
139139 private logName : string ;
140- private resource : types . MonitoredResource | undefined ;
140+ private resource : types . MonitoredResource | undefined ;
141141 private serviceContext ?: types . ServiceContext ;
142- stackdriverLog :
143- types . StackdriverLog ; // TODO: add type for @google -cloud/logging
142+ stackdriverLog : types . StackdriverLog ; // TODO: add type for @google -cloud/logging
144143 constructor ( options ?: types . Options ) {
145144 options = options || { } ;
146145 super ( { objectMode : true } ) ;
147146 this . logName = options . logName || 'bunyan_log' ;
148147 this . resource = options . resource ;
149148 this . serviceContext = options . serviceContext ;
150- this . stackdriverLog = ( new Logging ( options ) ) . log ( this . logName , {
149+ this . stackdriverLog = new Logging ( options ) . log ( this . logName , {
151150 removeCircular : true ,
152151 } ) ;
153152
@@ -160,20 +159,21 @@ export class LoggingBunyan extends Writable {
160159 // that serviceContext.service is specified.
161160 if ( this . serviceContext && ! this . serviceContext . service ) {
162161 throw new Error (
163- `If 'serviceContext' is specified then ` +
164- `'serviceContext.service' is required.` ) ;
162+ `If 'serviceContext' is specified then ` +
163+ `'serviceContext.service' is required.`
164+ ) ;
165165 }
166166
167167 /* Asynchrnously attempt to discover the service context. */
168168 if ( ! this . serviceContext ) {
169- detectServiceContext ( this . stackdriverLog . logging . auth )
170- . then (
171- ( serviceContext : types . ServiceContext ) => {
172- this . serviceContext = serviceContext ;
173- } ,
174- ( ) => {
175- /* swallow any errors. */
176- } ) ;
169+ detectServiceContext ( this . stackdriverLog . logging . auth ) . then (
170+ ( serviceContext : types . ServiceContext ) => {
171+ this . serviceContext = serviceContext ;
172+ } ,
173+ ( ) => {
174+ /* swallow any errors. */
175+ }
176+ ) ;
177177 }
178178 }
179179
@@ -188,10 +188,11 @@ export class LoggingBunyan extends Writable {
188188 /**
189189 * Format a bunyan record into a Stackdriver log entry.
190190 */
191- private formatEntry_ ( record : string | types . BunyanLogRecord ) {
191+ private formatEntry_ ( record : string | types . BunyanLogRecord ) {
192192 if ( typeof record === 'string' ) {
193193 throw new Error (
194- '@google-cloud/logging-bunyan only works as a raw bunyan stream type.' ) ;
194+ '@google-cloud/logging-bunyan only works as a raw bunyan stream type.'
195+ ) ;
195196 }
196197 // Stackdriver Log Viewer picks up the summary line from the 'message' field
197198 // of the payload. Unless the user has provided a 'message' property also,
@@ -216,7 +217,7 @@ export class LoggingBunyan extends Writable {
216217 const entryMetadata : types . StackdriverEntryMetadata = {
217218 resource : this . resource ,
218219 timestamp : record . time ,
219- severity : BUNYAN_TO_STACKDRIVER . get ( Number ( record . level ) )
220+ severity : BUNYAN_TO_STACKDRIVER . get ( Number ( record . level ) ) ,
220221 } ;
221222
222223 // If the record contains a httpRequest property, provide it on the entry
@@ -268,15 +269,18 @@ export class LoggingBunyan extends Writable {
268269 * we may well be in a different continuation.
269270 */
270271 write ( record : types . BunyanLogRecord , callback ?: Function ) : boolean ;
271- write ( record : types . BunyanLogRecord , encoding ?: string , callback ?: Function ) :
272- boolean ;
272+ write (
273+ record : types . BunyanLogRecord ,
274+ encoding ?: string ,
275+ callback ?: Function
276+ ) : boolean ;
273277 // Writable.write used 'any' in function signature.
274278 // tslint:disable-next-line:no-any
275279 write ( ...args : any [ ] ) : boolean {
276280 let record = args [ 0 ] ;
277- let encoding : string | null = null ;
278- type Callback = ( error : Error | null | undefined ) => void ;
279- let callback : Callback | string ;
281+ let encoding : string | null = null ;
282+ type Callback = ( error : Error | null | undefined ) => void ;
283+ let callback : Callback | string ;
280284 if ( typeof args [ 1 ] === 'string' ) {
281285 encoding = args [ 1 ] ;
282286 callback = args [ 2 ] ;
@@ -312,15 +316,15 @@ export class LoggingBunyan extends Writable {
312316 */
313317 // Writable._write used 'any' in function signature.
314318 _writev (
315- chunks : Array < {
316- // tslint:disable-next-line:no-any
317- chunk : any ; encoding : string ;
318- } > ,
319- callback : Function ) {
320- const entries = chunks . map ( ( request : {
321- // tslint:disable-next-line:no-any
322- chunk : any ; encoding : string ;
323- } ) => {
319+ chunks : Array < {
320+ // tslint:disable-next-line:no-any
321+ chunk : any ;
322+ encoding : string ;
323+ } > ,
324+ callback : Function
325+ ) {
326+ const entries = chunks . map ( ( request : { // tslint:disable-next-line:no-any
327+ chunk : any ; encoding : string } ) => {
324328 return this . formatEntry_ ( request . chunk ) ;
325329 } ) ;
326330
@@ -336,4 +340,4 @@ module.exports.BUNYAN_TO_STACKDRIVER = BUNYAN_TO_STACKDRIVER;
336340 * @name LoggingBunyan.LOGGING_TRACE_KEY
337341 * @type {string }
338342 */
339- module . exports . LOGGING_TRACE_KEY = LOGGING_TRACE_KEY ;
343+ module . exports . LOGGING_TRACE_KEY = LOGGING_TRACE_KEY ;
0 commit comments