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
Property Value
logging
Property Value
maxEntrySize
Property Value
name
Property Value
removeCircular_
removeCircular_: boolean;
Property Value
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
alert(entry, callback)
alert(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
Name | Description |
entry |
Entry | Entry[]
|
callback |
ApiResponseCallback
|
Returns
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
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
critical(entry, callback)
critical(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
Name | Description |
entry |
Entry | Entry[]
|
callback |
ApiResponseCallback
|
Returns
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
debug(entry, callback)
debug(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
Name | Description |
entry |
Entry | Entry[]
|
callback |
ApiResponseCallback
|
Returns
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
delete(callback)
delete(callback: DeleteCallback): void;
Parameter
Name | Description |
callback |
DeleteCallback
|
Returns
emergency(entry, options, callback)
emergency(entry: Entry | Entry[], options: WriteOptions, callback: ApiResponseCallback): void;
Parameters
Name | Description |
entry |
Entry | Entry[]
|
options |
WriteOptions
|
callback |
ApiResponseCallback
|
Returns
emergency(entry, callback)
emergency(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
Name | Description |
entry |
Entry | Entry[]
|
callback |
ApiResponseCallback
|
Returns
entry(metadata)
entry(metadata?: LogEntry): Entry;
Parameter
Name | Description |
metadata |
LogEntry
|
Returns
entry(data)
entry(data?: string | {}): Entry;
Parameter
Name | Description |
data |
string | {}
|
Returns
entry(metadata, data)
entry(metadata?: LogEntry, data?: string | {}): Entry;
Parameters
Name | Description |
metadata |
LogEntry
|
data |
string | {}
|
Returns
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
error(entry, callback)
error(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
Name | Description |
entry |
Entry | Entry[]
|
callback |
ApiResponseCallback
|
Returns
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
Returns
getEntries(options, callback)
getEntries(options: GetEntriesRequest, callback: GetEntriesCallback): void;
Parameters
Returns
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
info(entry, callback)
info(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
Name | Description |
entry |
Entry | Entry[]
|
callback |
ApiResponseCallback
|
Returns
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
notice(entry, callback)
notice(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
Name | Description |
entry |
Entry | Entry[]
|
callback |
ApiResponseCallback
|
Returns
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
warning(entry, callback)
warning(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
Name | Description |
entry |
Entry | Entry[]
|
callback |
ApiResponseCallback
|
Returns
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
write(entry, callback)
write(entry: Entry | Entry[], callback: ApiResponseCallback): void;
Parameters
Name | Description |
entry |
Entry | Entry[]
|
callback |
ApiResponseCallback
|
Returns