Constructor
new Entry(metadataopt, nullable, data)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
metadata |
object |
<optional> <nullable> |
See a LogEntry Resource. |
data |
object | string |
The data to use as the value for this log entry.
|
Example
```
const {Logging} = require('@google-cloud/logging');
const logging = new Logging();
const syslog = logging.log('syslog');
const metadata = {
resource: {
type: 'gce_instance',
labels: {
zone: 'global',
instance_id: '3'
}
}
};
const entry = syslog.entry(metadata, {
delegate: 'my_username'
});
syslog.alert(entry, (err, apiResponse) => {
if (!err) {
// Log entry inserted successfully.
}
});
//-
// You will also receive `Entry` objects when using
// Logging#getEntries() and Log#getEntries().
//-
logging.getEntries((err, entries) => {
if (!err) {
// entries[0].data = The data value from the log entry.
}
});
```
Members
data
metadata
Properties:
Name | Type | Description |
---|---|---|
timestamp |
Date | |
insertId |
number |
Methods
isObject(value)
Determines whether value
is a JavaScript object.
Parameters:
Name | Type | Description |
---|---|---|
value |
The value to be checked |
Returns:
Type | Description |
---|---|
true if |
toJSON(optionsopt, projectIdopt)
Serialize an entry to the format the API expects. Read more: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry
Parameters:
Name | Type | Attributes | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
Configuration object. Properties
|
||||||||
projectId |
string |
<optional> |
GCP Project ID. |
toStructuredJSON()
Serialize an entry to a standard format for any transports, e.g. agents. Read more: https://cloud.google.com/logging/docs/structured-logging