@@ -44,15 +44,14 @@ module.exports = {
44
44
this . options . stage ,
45
45
this . options . region )
46
46
. then ( reply => {
47
- if ( ! reply || reply . logStreams . length === 0 ) {
47
+ if ( ! reply || _ . isEmpty ( reply . logStreams ) ) {
48
48
throw new this . serverless . classes
49
49
. Error ( 'No existing streams for the function alias' ) ;
50
50
}
51
51
52
- return _ . chain ( reply . logStreams )
53
- . filter ( stream => _ . includes ( stream . logStreamName , `[${ version } ]` ) )
54
- . map ( 'logStreamName' )
55
- . value ( ) ;
52
+ return _ . map (
53
+ _ . filter ( reply . logStreams , stream => _ . includes ( stream . logStreamName , `[${ version } ]` ) ) ,
54
+ stream => stream . logStreamName ) ;
56
55
} ) ;
57
56
} ) ;
58
57
@@ -71,24 +70,24 @@ module.exports = {
71
70
let msg = msgParam ;
72
71
const dateFormat = 'YYYY-MM-DD HH:mm:ss.SSS (Z)' ;
73
72
74
- if ( msg . startsWith ( 'REPORT' ) ) {
73
+ if ( _ . startsWith ( msg , 'REPORT' ) ) {
75
74
msg += os . EOL ;
76
75
}
77
76
78
- if ( msg . startsWith ( 'START' ) || msg . startsWith ( 'END' ) || msg . startsWith ( 'REPORT' ) ) {
77
+ if ( _ . startsWith ( msg , 'START' ) || _ . startsWith ( msg , 'END' ) || _ . startsWith ( msg , 'REPORT' ) ) {
79
78
return chalk . gray ( msg ) ;
80
- } else if ( msg . trim ( ) === 'Process exited before completing request' ) {
79
+ } else if ( _ . trim ( msg ) === 'Process exited before completing request' ) {
81
80
return chalk . red ( msg ) ;
82
81
}
83
82
84
- const splitted = msg . split ( '\t' ) ;
83
+ const splitted = _ . split ( msg , '\t' ) ;
85
84
86
85
if ( splitted . length < 3 || new Date ( splitted [ 0 ] ) === 'Invalid Date' ) {
87
86
return msg ;
88
87
}
89
88
const reqId = splitted [ 1 ] ;
90
89
const time = chalk . green ( moment ( splitted [ 0 ] ) . format ( dateFormat ) ) ;
91
- const text = msg . split ( `${ reqId } \t` ) [ 1 ] ;
90
+ const text = _ . split ( msg , `${ reqId } \t` ) [ 1 ] ;
92
91
93
92
return `${ time } \t${ chalk . yellow ( reqId ) } \t${ text } ` ;
94
93
} ;
@@ -103,12 +102,12 @@ module.exports = {
103
102
if ( this . options . filter ) params . filterPattern = this . options . filter ;
104
103
if ( this . options . nextToken ) params . nextToken = this . options . nextToken ;
105
104
if ( this . options . startTime ) {
106
- const since = ( [ 'm' , 'h' , 'd' ]
107
- . indexOf ( this . options . startTime [ this . options . startTime . length - 1 ] ) !== - 1 ) ;
105
+ const since = _ . includes ( [ 'm' , 'h' , 'd' ] ,
106
+ this . options . startTime [ this . options . startTime . length - 1 ] ) ;
108
107
if ( since ) {
109
- params . startTime = moment ( ) . subtract ( this . options
110
- . startTime . replace ( / \D / g, '' ) , this . options
111
- . startTime . replace ( / \d / g, '' ) ) . valueOf ( ) ;
108
+ params . startTime = moment ( ) . subtract (
109
+ _ . replace ( this . options . startTime , / \D / g, '' ) ,
110
+ _ . replace ( this . options . startTime , / \d / g, '' ) ) . valueOf ( ) ;
112
111
} else {
113
112
params . startTime = moment . utc ( this . options . startTime ) . valueOf ( ) ;
114
113
}
@@ -122,7 +121,7 @@ module.exports = {
122
121
this . options . region )
123
122
. then ( results => {
124
123
if ( results . events ) {
125
- results . events . forEach ( e => {
124
+ _ . forEach ( results . events , e => {
126
125
process . stdout . write ( formatLambdaLogEvent ( e . message ) ) ;
127
126
} ) ;
128
127
}
0 commit comments