As mentioned in this documentation on Viewing logs
Logs for Cloud Functions are viewable either in the Google Cloud
Console, Cloud Logging UI, or via the firebase command-line tool.
Using the Firebase CLI To view logs with the firebase tool, use the
functions:log command: firebase functions:log
To view logs for a specific function, provide the function name as an
argument:
firebase functions:log --only <FUNCTION_NAME>
For the full range
of log viewing options, view the help for functions:log:
firebase help functions:log
You can view logs for Cloud Functions in the Cloud Logging UI using
filter as those resource types
resource.type="cloud_function"
Refer this npm docs on npm logging.
The npm CLI has various mechanisms for showing different levels of
information back to end-users for certain commands, configurations &
environments.
All logs are written to a debug log, with the path to that file
printed if the execution of a command fails.You can find the
npm-debug.log
file in your .npm
directory. To find your .npm
directory, use npm config get cache
.
You can also check this stackoverflow thread