Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
'use strict';
// [START setup]
// By default, gcloud will authenticate using the service account file specified
// by the GOOGLE_APPLICATION_CREDENTIALS environment variable and use the
// project specified by the GCLOUD_PROJECT environment variable. See
// https://googlecloudplatform.github.io/gcloud-node/#/docs/guides/authentication
var gcloud = require('gcloud');
// Get a reference to the logging component
var logging = gcloud.logging();
// [END setup]
// [START listSinks]
/**
* @param {Function} callback Callback function.
*/
function listSinksExample (callback) {
// list all sinks in the authenticated project
logging.getSinks(function (err, sinks) {
if (err) {
return callback(err);
}
// Should have received all sinks
console.log('Found ' + sinks.length + ' sinks');
callback(null, sinks);
/* jshint camelcase:false */
'use strict';
var async = require('async');
// [START write]
// [START setup]
// By default, gcloud will authenticate using the service account file specified
// by the GOOGLE_APPLICATION_CREDENTIALS environment variable and use the
// project specified by the GCLOUD_PROJECT environment variable. See
// https://googlecloudplatform.github.io/gcloud-node/#/docs/guides/authentication
var gcloud = require('gcloud');
// Get a reference to the logging component
var logging = gcloud.logging();
// [END setup]
/**
* @param {string} logName Name of the log to write to.
* @param {Function} callback Callback function.
*/
function writeExample (logName, callback) {
// Get a reference to an existing log
var log = logging.log(logName);
// Modify this resource type to match a resource in your project
// See https://cloud.google.com/logging/docs/api/ref_v2beta1/rest \
// /v2beta1/monitoredResourceDescriptors/list
var resource = {
type: 'gae_app',
// This example targets a "App Engine" resource in the default module with
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
'use strict';
// [START list]
// [START auth]
// By default, gcloud will authenticate using the service account file specified
// by the GOOGLE_APPLICATION_CREDENTIALS environment variable and use the
// project specified by the GCLOUD_PROJECT environment variable. See
// https://googlecloudplatform.github.io/gcloud-node/#/docs/guides/authentication
var gcloud = require('gcloud');
// Get a reference to the logging component
var logging = gcloud.logging();
// [END auth]
/**
* @param {Object} [options] Configuration options for the request.
* @param {Function} callback Callback function.
*/
function listExample (options, callback) {
if (typeof options === 'function') {
callback = options;
}
// Retrieve the latest some log entries from the authenticated project.
logging.getEntries(options, function (err, entries, nextQuery, apiResponse) {
if (err) {
return callback(err);
}