Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Viewing logs

Jason Dobry edited this page Dec 30, 2016 · 5 revisions

Table of Contents

Viewing the logs

Viewing your functions' logs is easy:

functions logs read

By default it will print the last 20 lines. You can view more with the --limit flag:

functions logs read --limit=100

or

functions logs read -l=100

Configuring the log file

Logs are written to the file specified by the logFile setting. The default location for the log file is logs/cloud-functions-emulator.log, relative to the directory where the Emulator is installed.

You can set the absolute location for the log file:

functions config set logFile /your/desired/path/to/the/logfile.log

or specify a relative path, which will be interpreted as being relative to the Emulator's installation directory:

function config set logFile relative/path/to/logfile.log

You can view the full path to the current log file with:

functions status

If the Emulator is currently running, then you'll see an entry printed like this:

├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Log file       │ /Users/jmdobry/.nvm/versions/node/v6.9.1/lib/node_modules/@google-cloud/functions-emulator/logs/cloud-functions-emulator.log │
├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤

If the Emulator is stopped, then it will try to print the path to the log file last used:

├───────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Last log file │ /Users/jmdobry/.nvm/versions/node/v6.9.1/lib/node_modules/@google-cloud/functions-emulator/logs/cloud-functions-emulator.log │
└───────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘