Skip to content

Commit

Permalink
Merge pull request #123 from casanet/download-logs-feature
Browse files Browse the repository at this point in the history
Download logs feature - Replace logger library
  • Loading branch information
haimkastner authored Mar 10, 2020
2 parents f3c699b + 8e6c98f commit 696164d
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 84 deletions.
3 changes: 2 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bundle/
temp/
temp/
dist/
203 changes: 145 additions & 58 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"ip": "^1.1.5",
"is-online": "^8.2.1",
"joi": "^14.3.0",
"log4js": "^3.0.6",
"macaddress": "^0.2.9",
"miio": "^0.15.6",
"moment": "^2.23.0",
Expand All @@ -81,6 +80,7 @@
"suncalc": "^1.8.0",
"tsoa": "2.4.3",
"tuyapi": "^5.1.2",
"winston": "^3.2.1",
"yeelight-awesome": "^1.0.12"
},
"devDependencies": {
Expand Down Expand Up @@ -109,9 +109,9 @@
"del-cli": "^1.1.0",
"mocha": "^6.1.4",
"nyc": "^15.0.0",
"pkg": "^4.4.3",
"prettier": "^1.19.1",
"simple-git": "^1.121.0",
"pkg": "^4.4.3",
"ts-node": "^7.0.1",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
Expand Down
2 changes: 1 addition & 1 deletion backend/src/controllers/logsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export class LogsController extends Controller {
logger.info('[logs controller] Downloading log file...');
res.setHeader('Content-Type', 'text/plain');
res.setHeader('Content-Disposition', `attachment; filename=casalogs_${new Date().toLocaleDateString()}.log`);
res.end(await fse.promises.readFile('./logs/tech_log.log'));
res.end(await fse.promises.readFile('./logs/casalogs.log'));
}
}
2 changes: 1 addition & 1 deletion backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if (Configuration.http.useHttps) {
logger.info('HTTPS/SSL listen on port ' + Configuration.http.httpsPort);
});
} catch (error) {
logger.fatal(`Faild to load SSL certificate ${error}, exit...`);
logger.error(`Faild to load SSL certificate ${error}, exit...`);
process.exit();
}
}
2 changes: 1 addition & 1 deletion backend/src/security/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const expressAuthentication = async (
): Promise<User | ErrorResponse> => {
// If the routing security sent wrong security scope.
if (!scopes || scopes.length < 1) {
logger.fatal('invalid or empty security scope');
logger.error('invalid or empty security scope');
throw {
responseCode: 1501,
} as ErrorResponse;
Expand Down
Loading

0 comments on commit 696164d

Please sign in to comment.