MCPcopy
hub / github.com/serverless/serverless / constructor

Method constructor

packages/serverless/lib/plugins/aws/logs.js:14–49  ·  view source on GitHub ↗
(serverless, options, pluginUtils)

Source from the content-addressed store, hash-verified

12
13class AwsLogs {
14 constructor(serverless, options, pluginUtils) {
15 this.serverless = serverless
16 this.options = options || {}
17 this.provider = this.serverless.getProvider('aws')
18 this.logger = pluginUtils.log
19 this.progress = pluginUtils.progress
20
21 Object.assign(this, validate)
22
23 this.hooks = {
24 'logs:logs': async () => {
25 if (!this.options.function && !this.options.agent) {
26 throw new ServerlessError(
27 'One of the required options must be provided: --function (-f) or --agent (-a)',
28 'LOGS_MISSING_OPTION',
29 )
30 }
31
32 if (this.options.agent) {
33 return
34 }
35
36 if (!this.options.tail) {
37 this.progress.notice('Fetching logs')
38 } else {
39 this.logger.aside(
40 `Streaming new logs for function: "${this.options.function}"`,
41 )
42 this.progress.notice('Listening')
43 }
44 this.extendedValidate()
45 const logStreamNames = await this.getLogStreams()
46 await this.showLogs(logStreamNames)
47 },
48 }
49 }
50
51 extendedValidate() {
52 this.validate()

Callers

nothing calls this directly

Calls 6

extendedValidateMethod · 0.95
getLogStreamsMethod · 0.95
showLogsMethod · 0.95
asideMethod · 0.80
getProviderMethod · 0.45
noticeMethod · 0.45

Tested by

no test coverage detected