List logs

Demonstrates how to list the names of available Logs.

Documentation pages that include this code sample

To view the code sample used in context, see the following documentation:

Code sample


To learn how to install and use the client library for Logging, see Logging client libraries.

// Imports the Google Cloud client library
const {Logging} = require('@google-cloud/logging');

// Creates a client
const logging = new Logging();

async function printLogNames() {
  const [logs] = await logging.getLogs();
  logs.forEach(log => {

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.