Class Log (9.3.1)

A log is a named collection of entries, each entry representing a timestamped event. Logs can be produced by Google Cloud Platform services, by third-party services, or by your applications. For example, the log apache-access is produced by the Apache Web Server, but the log compute.googleapis.com/activity_log is produced by Google Compute Engine.

[Introduction to Logs] https://cloud.google.com/logging/docs/basic-concepts#logs

Package

@google-cloud/logging!

Constructors

(constructor)(logging, name, options)

  constructor 
 ( 
 logging 
 : 
  
 Logging 
 , 
  
 name 
 : 
  
 string 
 , 
  
 options 
 ?: 
  
 LogOptions 
 ); 
 

Constructs a new instance of the Log class

Parameters
Name Description
logging Logging
name string
options LogOptions

Properties

formattedName_

  formattedName_ 
 : 
  
 string 
 ; 
 
Property Value
Type Description
string

logging

  logging 
 : 
  
 Logging 
 ; 
 
Property Value
Type Description
Logging

maxEntrySize

  maxEntrySize 
 ?: 
  
 number 
 ; 
 
Property Value
Type Description
number

name

  name 
 : 
  
 string 
 ; 
 
Property Value
Type Description
string

removeCircular_

  removeCircular_ 
 : 
  
 boolean 
 ; 
 
Property Value
Type Description
boolean

Methods

alert(entry, options)

  alert 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 ?: 
  
 WriteOptions 
 ) 
 : 
  
 Promise<ApiResponse> 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
Returns
Type Description
Promise < ApiResponse >

alert(entry, options, callback)

  alert 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 : 
  
 WriteOptions 
 , 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
callback ApiResponseCallback
Returns
Type Description
void

alert(entry, callback)

  alert 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
callback ApiResponseCallback
Returns
Type Description
void

assignSeverityToEntries_(entries, severity)

  static 
  
 assignSeverityToEntries_ 
 ( 
 entries 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 severity 
 : 
  
 string 
 ) 
 : 
  
 Entry 
 []; 
 

Return an array of log entries with the desired severity assigned.

Parameters
Name Description
entries Entry | Entry []

Log entries.

severity string

The desired severity level.

Returns
Type Description
Entry []

critical(entry, options)

  critical 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 ?: 
  
 WriteOptions 
 ) 
 : 
  
 Promise<ApiResponse> 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
Returns
Type Description
Promise < ApiResponse >

critical(entry, options, callback)

  critical 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 : 
  
 WriteOptions 
 , 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
callback ApiResponseCallback
Returns
Type Description
void

critical(entry, callback)

  critical 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
callback ApiResponseCallback
Returns
Type Description
void

debug(entry, options)

  debug 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 ?: 
  
 WriteOptions 
 ) 
 : 
  
 Promise<ApiResponse> 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
Returns
Type Description
Promise < ApiResponse >

debug(entry, options, callback)

  debug 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 : 
  
 WriteOptions 
 , 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
callback ApiResponseCallback
Returns
Type Description
void

debug(entry, callback)

  debug 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
callback ApiResponseCallback
Returns
Type Description
void

delete(gaxOptions)

  delete 
 ( 
 gaxOptions 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise<ApiResponse> 
 ; 
 
Parameter
Name Description
gaxOptions CallOptions
Returns
Type Description
Promise < ApiResponse >

delete(gaxOptions, callback)

  delete 
 ( 
 gaxOptions 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 DeleteCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
gaxOptions CallOptions
callback DeleteCallback
Returns
Type Description
void

delete(callback)

  delete 
 ( 
 callback 
 : 
  
 DeleteCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameter
Name Description
callback DeleteCallback
Returns
Type Description
void

emergency(entry, options, callback)

  emergency 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 : 
  
 WriteOptions 
 , 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
callback ApiResponseCallback
Returns
Type Description
void

emergency(entry, callback)

  emergency 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
callback ApiResponseCallback
Returns
Type Description
void

entry(metadata)

  entry 
 ( 
 metadata 
 ?: 
  
 LogEntry 
 ) 
 : 
  
 Entry 
 ; 
 
Parameter
Name Description
metadata LogEntry
Returns
Type Description
Entry

entry(data)

  entry 
 ( 
 data 
 ?: 
  
 string 
  
 | 
  
 {}) 
 : 
  
 Entry 
 ; 
 
Parameter
Name Description
data string | {}
Returns
Type Description
Entry

entry(metadata, data)

  entry 
 ( 
 metadata 
 ?: 
  
 LogEntry 
 , 
  
 data 
 ?: 
  
 string 
  
 | 
  
 {}) 
 : 
  
 Entry 
 ; 
 
Parameters
Name Description
metadata LogEntry
data string | {}
Returns
Type Description
Entry

error(entry, options)

  error 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 ?: 
  
 WriteOptions 
 ) 
 : 
  
 Promise<ApiResponse> 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
Returns
Type Description
Promise < ApiResponse >

error(entry, options, callback)

  error 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 : 
  
 WriteOptions 
 , 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
callback ApiResponseCallback
Returns
Type Description
void

error(entry, callback)

  error 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
callback ApiResponseCallback
Returns
Type Description
void

formatName_(projectId, name)

  static 
  
 formatName_ 
 ( 
 projectId 
 : 
  
 string 
 , 
  
 name 
 : 
  
 string 
 ) 
 : 
  
 string 
 ; 
 

Format the name of a log. A log's full name is in the format of 'projects/{projectId}/logs/{logName}'.

Parameters
Name Description
projectId string
name string
Returns
Type Description
string

{string}

getEntries(options)

  getEntries 
 ( 
 options 
 ?: 
  
 GetEntriesRequest 
 ) 
 : 
  
 Promise<GetEntriesResponse> 
 ; 
 
Parameter
Name Description
options GetEntriesRequest
Returns
Type Description
Promise < GetEntriesResponse >

getEntries(callback)

  getEntries 
 ( 
 callback 
 : 
  
 GetEntriesCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameter
Name Description
callback GetEntriesCallback
Returns
Type Description
void

getEntries(options, callback)

  getEntries 
 ( 
 options 
 : 
  
 GetEntriesRequest 
 , 
  
 callback 
 : 
  
 GetEntriesCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
options GetEntriesRequest
callback GetEntriesCallback
Returns
Type Description
void

getEntriesStream(options)

  getEntriesStream 
 ( 
 options 
 : 
  
 GetEntriesRequest 
 ) 
 : 
  
 import 
 ( 
 "stream" 
 ). 
 Duplex 
 ; 
 

This method is a wrapper around {module:logging#getEntriesStream}, but with a filter specified to only return {module:logging/entry} objects from this log.

Log#getEntriesStream

Parameter
Name Description
options GetEntriesRequest
Returns
Type Description
import("stream"). internal.Duplex

{ReadableStream} A readable stream that emits Entry instances.

info(entry, options)

  info 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 ?: 
  
 WriteOptions 
 ) 
 : 
  
 Promise<ApiResponse> 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
Returns
Type Description
Promise < ApiResponse >

info(entry, options, callback)

  info 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 : 
  
 WriteOptions 
 , 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
callback ApiResponseCallback
Returns
Type Description
void

info(entry, callback)

  info 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
callback ApiResponseCallback
Returns
Type Description
void

notice(entry, options)

  notice 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 ?: 
  
 WriteOptions 
 ) 
 : 
  
 Promise<ApiResponse> 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
Returns
Type Description
Promise < ApiResponse >

notice(entry, options, callback)

  notice 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 : 
  
 WriteOptions 
 , 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
callback ApiResponseCallback
Returns
Type Description
void

notice(entry, callback)

  notice 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
callback ApiResponseCallback
Returns
Type Description
void

tailEntries(options)

  tailEntries 
 ( 
 options 
 ?: 
  
 TailEntriesRequest 
 ) 
 : 
  
 import 
 ( 
 "stream" 
 ). 
 Duplex 
 ; 
 

This method is a wrapper around {module:logging#tailEntries}, but with a filter specified to only return {module:logging/entry} objects from this log.

Log#tailEntries

Parameter
Name Description
options TailEntriesRequest
Returns
Type Description
import("stream"). internal.Duplex

{DuplexStream} A duplex stream that emits TailEntriesResponses containing an array of Entry instances.

warning(entry, options)

  warning 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 ?: 
  
 WriteOptions 
 ) 
 : 
  
 Promise<ApiResponse> 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
Returns
Type Description
Promise < ApiResponse >

warning(entry, options, callback)

  warning 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 : 
  
 WriteOptions 
 , 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
callback ApiResponseCallback
Returns
Type Description
void

warning(entry, callback)

  warning 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
callback ApiResponseCallback
Returns
Type Description
void

write(entry, options)

  write 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 ?: 
  
 WriteOptions 
 ) 
 : 
  
 Promise<ApiResponse> 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
Returns
Type Description
Promise < ApiResponse >

write(entry, options, callback)

  write 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 options 
 : 
  
 WriteOptions 
 , 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
options WriteOptions
callback ApiResponseCallback
Returns
Type Description
void

write(entry, callback)

  write 
 ( 
 entry 
 : 
  
 Entry 
  
 | 
  
 Entry 
 [], 
  
 callback 
 : 
  
 ApiResponseCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name Description
entry Entry | Entry []
callback ApiResponseCallback
Returns
Type Description
void
Design a Mobile Site
View Site in Mobile | Classic
Share by: