Skip to content

Commit 162eb0f

Browse files
Merge pull request #13 from Shahnawaz-Sk/master
changes for logger
2 parents ed13e4f + 60f2eed commit 162eb0f

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

lib/logger.js

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
/**
22
* logger for create logFile as lambda_api.log to current dir if path is not passed by User.
33
*/
4-
var winston = require("winston");
5-
module.exports = function(logFile) {
6-
var winstonFormat = winston.format;
7-
return winston.createLogger({
8-
level: "info",
9-
format: winstonFormat.combine(
10-
winstonFormat.timestamp(),
11-
winstonFormat.json()
12-
),
13-
transports: [new winston.transports.File({ filename: logFile ? logFile : "lambda_api.log" })]
14-
});
15-
};
4+
var winston = require("winston");
5+
6+
function logging(logFile){
7+
var winstonFormat = winston.format;
8+
if (process.env.LT_API_LOG === "true"){
9+
return winston.createLogger({
10+
level: "info",
11+
format: winstonFormat.combine(
12+
winstonFormat.timestamp(),
13+
winstonFormat.json()
14+
),
15+
transports: [new winston.transports.File({ filename: logFile ? logFile : "lambda_api.log" })]
16+
});
17+
}
18+
return winston.createLogger({
19+
level: "info",
20+
silent:"true",
21+
format: winstonFormat.combine(
22+
winstonFormat.timestamp(),
23+
winstonFormat.json()
24+
),
25+
transports: [new winston.transports.Console()]
26+
});
27+
28+
};
29+
module.exports = logging

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lambdatest/node-rest-client",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "LambdaTest Rest Client for Node.js",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)