You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
where `update:false` means to use the existing HAR from from the path given in first paraeter `har/personalInfo.har`, to see this in action you can turn off your internet and run the script, complete webpage is mocked up along with assertions on the browser of your choice this is done using the Network Replay feature and by using our recorded HAR file.
202
202
We can use this feature when webpage is down for some reason and we want to test some scenarios.
203
+
22. Logging is implemented in `CustomReporterConfig.ts` using winston logger.
204
+
205
+
First we have to create a logger object using winston.createLogger and then provid the configuration you need.
206
+
First argument is "level" for which i have provided value as "info", in winston logger every logging level is provided with a numeric value, for info the numeric value is 2, so if we provide level as info then all the logs which are equal to or less than info level will be displayed. In our case logs with error(0) and warn(1) wil also be logged. For more info on logging refer below link
207
+
`https://github.com/winstonjs/winston#logging`
208
+
209
+
Second we have to provide format for the log file generate I have provided format as json using ` winston.format.json()` because JSON is widely used. There are various levels like printf, simple, colorize which you can refer in below link
210
+
`https://github.com/winstonjs/logform#formats`
211
+
212
+
Third part is transports which defines where the log file will be written. I have provided the location as `logs/info.log` in my case
213
+
214
+
Once logger object is created I have provided `logger.add(console);` which instructs logger to write the log files in console as well.
215
+
216
+
Once logger object is created you can use this instead of console.log in your framework and these logs will be written both in your console and log file.
0 commit comments