1.0.4 • Published 4 years ago
log-parser-code-test v1.0.4
Log Parser Module
Log Parser for HTTP Request log file
Tech Stack
Technology | Description | Link ↘️ |
---|---|---|
JavaScript | High Level, Dynamic, Interpreted Language | ---- |
Node JS | JavaScript Runtime | https://nodejs.org/en/ |
oclif | Open CLI Framework | https://oclif.io/ |
Usage
Local
Ensure Node.js and NPM or Yarn are installed
- Install required dependencies
npm install or npm i
- Run the application
./bin/run.cmd or ./bin/run
Commands
log-parser analyse [FILE]
Analyse log file with HTTP Requests
USAGE
$ log-parser analyse [FILE]
OPTIONS
-f, --file
-h, --help show CLI help
See code: src\commands\analyse.ts
log-parser help [COMMAND]
display help for log-parser
USAGE
$ log-parser help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
See code: @oclif/plugin-help
Testing
In order to test, run the following command:
npm run test
Considerations-Thoughts
- While choosing the top 3 active IP addresses or visited urls, there were some that were overlapping. For now, sort and only retrieved the top 3.
- Decided to go with TypeScript for type safety and extensibility in the future if required
- Arrow functions can be refactored if single parameter but oclif ESLint has it's own standards
- Making use of regex named groups to make it easier to group data required
- Could also use split instead of regex to potentially achieve the same result
Improvements to be made
- Testing coverage could possibly be improved
- Work on cleaning code up further and refactoring more