-
Notifications
You must be signed in to change notification settings - Fork 66
Update project logs #591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update project logs #591
Conversation
Couple comments/questions about the params:
|
Changing to
|
packages/cli/commands/logs.js
Outdated
@@ -77,7 +77,7 @@ const endpointLog = async (accountId, options) => { | |||
}; | |||
|
|||
exports.command = 'logs [endpoint]'; | |||
exports.describe = 'get logs for a function'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this logs command only work for project functions now?
const { getProjectConfig } = require('../../lib/projects'); | ||
const { loadAndValidateOptions } = require('../../lib/validation'); | ||
const { tailLogs } = require('../../lib/serverlessLogs'); | ||
|
||
const handleLogsError = (e, accountId, projectName, appPath, functionName) => { | ||
if (e.statusCode === 404) { | ||
logger.error( | ||
`No logs were found for the function name '${functionName}' in the app path '${appPath}' within the project '${projectName}' in account ${accountId}.` | ||
appPath | ||
? `No logs were found for the function name '${functionName}' in the app path '${appPath}' within the project '${projectName}' in account ${accountId}.` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to rephrase this? It's four prepositional phrases in a row, I'm getting a little lost. Perhaps we could consult Erin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Ignore this comment, was a typo>
packages/cli/commands/logs.js
Outdated
@@ -77,7 +77,7 @@ const endpointLog = async (accountId, options) => { | |||
}; | |||
|
|||
exports.command = 'logs [endpoint]'; | |||
exports.describe = 'get logs for a function'; | |||
exports.describe = 'get logs for a function within a project'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this only used to get logs for functions within a project? What about functions outside of projects?
appPath: { | ||
describe: 'Path to app folder, relative to project', | ||
type: 'string', | ||
}, | ||
projectName: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noAppFunctionLogs: "No logs were found for the function name \"{{ functionName }}\" in the app path \"{{ appPath }}\" within the project \"{{ projectName }}\" in account {{ accountId }}." | ||
noEndpointLogs: "No logs were found for the function name \"{{ functionName }}\" within the project \"{{ projectName }}\" in account {{ accountId }}." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erincouse was hoping to get your feedback on these errors. They're shown when no logs are found
cc @kemmerle
Description and Context
Updates
hs project logs
to work with bothendpoint
andappFunction
logsTo retrieve endpoint logs:
hs project logs --function=endpoint/name
To retrieve appFunction logs
hs project logs --function=appFunctionName --appPath=app
Testing
Commands to run:
Endpoint logs:
hs project logs --function=endpoint/name
Tail Endpoint logs:
hs project logs --function=endpoint/name -follow
App function logs:
hs project logs --function=appFunctionName --appPath=app
Tail app function logs:
hs project logs --function=appFunctionName --appPath=app --follow
Screenshots
TODO
Who to Notify