Class Log (9.5.7)

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
NameDescription
logging Logging
name string
options LogOptions

Properties

formattedName_

formattedName_: string;
Property Value
TypeDescription
string

logging

logging: Logging;
Property Value
TypeDescription
Logging

maxEntrySize

maxEntrySize?: number;
Property Value
TypeDescription
number

name

name: string;
Property Value
TypeDescription
string

removeCircular_

removeCircular_: boolean;
Property Value
TypeDescription
boolean

Methods

alert(entry, options)

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

alert(entry, options, callback)

alert(entry: Entry | Entry[], options: WriteOptions, callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
options WriteOptions
callback ApiResponseCallback
Returns
TypeDescription
void

alert(entry, callback)

alert(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
callback ApiResponseCallback
Returns
TypeDescription
void

assignSeverityToEntries_(entries, severity)

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

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

Parameters
NameDescription
entries Entry | Entry[]

Log entries.

severity string

The desired severity level.

Returns
TypeDescription
Entry[]

critical(entry, options)

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

critical(entry, options, callback)

critical(entry: Entry | Entry[], options: WriteOptions, callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
options WriteOptions
callback ApiResponseCallback
Returns
TypeDescription
void

critical(entry, callback)

critical(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
callback ApiResponseCallback
Returns
TypeDescription
void

debug(entry, options)

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

debug(entry, options, callback)

debug(entry: Entry | Entry[], options: WriteOptions, callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
options WriteOptions
callback ApiResponseCallback
Returns
TypeDescription
void

debug(entry, callback)

debug(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
callback ApiResponseCallback
Returns
TypeDescription
void

delete(gaxOptions)

delete(gaxOptions?: CallOptions): Promise<ApiResponse>;
Parameter
NameDescription
gaxOptions CallOptions
Returns
TypeDescription
Promise<ApiResponse>

delete(gaxOptions, callback)

delete(gaxOptions: CallOptions, callback: DeleteCallback): void;
Parameters
NameDescription
gaxOptions CallOptions
callback DeleteCallback
Returns
TypeDescription
void

delete(callback)

delete(callback: DeleteCallback): void;
Parameter
NameDescription
callback DeleteCallback
Returns
TypeDescription
void

emergency(entry, options, callback)

emergency(entry: Entry | Entry[], options: WriteOptions, callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
options WriteOptions
callback ApiResponseCallback
Returns
TypeDescription
void

emergency(entry, callback)

emergency(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
callback ApiResponseCallback
Returns
TypeDescription
void

entry(metadata)

entry(metadata?: LogEntry): Entry;
Parameter
NameDescription
metadata LogEntry
Returns
TypeDescription
Entry

entry(data)

entry(data?: string | {}): Entry;
Parameter
NameDescription
data string | {}
Returns
TypeDescription
Entry

entry(metadata, data)

entry(metadata?: LogEntry, data?: string | {}): Entry;
Parameters
NameDescription
metadata LogEntry
data string | {}
Returns
TypeDescription
Entry

error(entry, options)

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

error(entry, options, callback)

error(entry: Entry | Entry[], options: WriteOptions, callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
options WriteOptions
callback ApiResponseCallback
Returns
TypeDescription
void

error(entry, callback)

error(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
callback ApiResponseCallback
Returns
TypeDescription
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
NameDescription
projectId string
name string
Returns
TypeDescription
string

{string}

getEntries(options)

getEntries(options?: GetEntriesRequest): Promise<GetEntriesResponse>;
Parameter
NameDescription
options GetEntriesRequest
Returns
TypeDescription
Promise<GetEntriesResponse>

getEntries(callback)

getEntries(callback: GetEntriesCallback): void;
Parameter
NameDescription
callback GetEntriesCallback
Returns
TypeDescription
void

getEntries(options, callback)

getEntries(options: GetEntriesRequest, callback: GetEntriesCallback): void;
Parameters
NameDescription
options GetEntriesRequest
callback GetEntriesCallback
Returns
TypeDescription
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
NameDescription
options GetEntriesRequest
Returns
TypeDescription
import("stream").internal.Duplex

{ReadableStream} A readable stream that emits Entry instances.

info(entry, options)

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

info(entry, options, callback)

info(entry: Entry | Entry[], options: WriteOptions, callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
options WriteOptions
callback ApiResponseCallback
Returns
TypeDescription
void

info(entry, callback)

info(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
callback ApiResponseCallback
Returns
TypeDescription
void

notice(entry, options)

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

notice(entry, options, callback)

notice(entry: Entry | Entry[], options: WriteOptions, callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
options WriteOptions
callback ApiResponseCallback
Returns
TypeDescription
void

notice(entry, callback)

notice(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
callback ApiResponseCallback
Returns
TypeDescription
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
NameDescription
options TailEntriesRequest
Returns
TypeDescription
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
NameDescription
entry Entry | Entry[]
options WriteOptions
Returns
TypeDescription
Promise<ApiResponse>

warning(entry, options, callback)

warning(entry: Entry | Entry[], options: WriteOptions, callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
options WriteOptions
callback ApiResponseCallback
Returns
TypeDescription
void

warning(entry, callback)

warning(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
callback ApiResponseCallback
Returns
TypeDescription
void

write(entry, options)

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

write(entry, options, callback)

write(entry: Entry | Entry[], options: WriteOptions, callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
options WriteOptions
callback ApiResponseCallback
Returns
TypeDescription
void

write(entry, callback)

write(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
NameDescription
entry Entry | Entry[]
callback ApiResponseCallback
Returns
TypeDescription
void