MCPcopy
hub / github.com/serverless/serverless / logOutputs

Method logOutputs

packages/serverless/lib/plugins/aws/dev/index.js:1196–1258  ·  view source on GitHub ↗

* Logs the first 10 functions and endpoints in the serviceOutputs Map.

()

Source from the content-addressed store, hash-verified

1194 * Logs the first 10 functions and endpoints in the serviceOutputs Map.
1195 */
1196 logOutputs() {
1197 /**
1198 * If this.serverless.serviceOutputs exists property exists,
1199 * loop through the "endpoints" and "functions" in this.serverless.serviceOutputs Map.
1200 * List the first 10 in the console.
1201 */
1202 try {
1203 if (this.serverless.serviceOutputs) {
1204 const functions = this.serverless.serviceOutputs.get('functions')
1205 if (Array.isArray(functions)) {
1206 const functionCount = functions.length
1207 const maxFunctions = 10
1208 let functionsLog = 'Functions:\n'
1209
1210 if (functionCount > 0) {
1211 for (let i = 0; i < Math.min(functionCount, maxFunctions); i++) {
1212 functionsLog += ` ${functions[i]}\n`
1213 }
1214
1215 if (functionCount > maxFunctions) {
1216 functionsLog += ` ... and ${functionCount - maxFunctions} more\n`
1217 }
1218 }
1219
1220 // Remove line break at the end
1221 functionsLog = functionsLog.slice(0, -1)
1222
1223 logger.aside(functionsLog)
1224 }
1225
1226 let endpoints = this.serverless.serviceOutputs.get('endpoints')
1227
1228 // If there is only one endpoint, it is stored as a separate property
1229 const singleEndpoint = this.serverless.serviceOutputs.get('endpoint')
1230
1231 endpoints = endpoints || (singleEndpoint ? [singleEndpoint] : null)
1232
1233 if (Array.isArray(endpoints)) {
1234 const endpointCount = endpoints.length
1235 const maxEndpoints = 10
1236 let endpointsLog = 'Endpoints:\n'
1237
1238 if (endpointCount > 0) {
1239 for (let i = 0; i < Math.min(endpointCount, maxEndpoints); i++) {
1240 endpointsLog += ` ${endpoints[i]}\n`
1241 }
1242
1243 if (endpointCount > maxEndpoints) {
1244 endpointsLog += ` ... and ${endpointCount - maxEndpoints} more\n`
1245 }
1246 }
1247
1248 // Remove line break at the end
1249 endpointsLog = endpointsLog.slice(0, -1)
1250
1251 logger.aside(endpointsLog)
1252 }
1253 }

Callers 1

devMethod · 0.95

Calls 3

asideMethod · 0.80
debugMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected