by TomCo (Technology & Online Media Company)
NPM Link (Published)
Contents
This is a simple and easy to use logging tool, that is also light-weight. It streams dynamically into a concise and pretty format, into .txt file, with all .txt files under one root directory (all done automatically). Simply add the module to your project,create a new instance for each logger you want, and away you go. For example you could create a new logger each for client-side or server-side logging separately, outputted to two txt files. See Usage and Screenshots for more information.
- TypeScript - Write in TypeScript (or JS), Compiles down to JavaScript.
- Nodejs - Node Runtime Environment.
- fs - Asynchronous File System methods.
- ESLint - Code Parsing, Styling & Error Checking.
- Tested with Mocha-Chai - Testing with Mocha Framework, using the Chai Library.
npm install simple-txt-logger
By default, all .txt log files are placed in a 'logs' folder/directory, which is automatically created in the root folder of the app.
- Create a new logger & log file, and continuously stream items or events to it:
(Arguments are optional)
const logger = new SimpleTxtLogger('<FileName?>', '<Env?>', '<AppName?>'); //Create a logger instance.
logger.writeToLogFile(<ItemToLog>); //Logs an item to the loggers current .txt log file.
logger.getPath(); //Output: '<path>/logs/*.txt'.
logger.close(); //Closes stream to the loggers .txt log file.
- Create a single data log dump, to log an item or event into a single txt file, one time only:
('Directory' Argument is optional)
logger.dumpToNewTxtFile('<ItemToLog>', '<FileName>', '<Directory?>'); //Create a single item log file.
Below is the refined and confirmed roadmap, that has been planned for completion. See open issues and also the project board, for any other proposed features or known issues, which may not be listed below.
Feature/Task/Bugfix | Details | Version (if released) | Notes |
---|---|---|---|
Bug#1 | Bug details... | 0.0.1 | example#1 |
Feature#4 | Feature details... | example#2 |
Version | Date | Changes |
---|---|---|
1.0.0 | 2021-07-09 |
|
1.0.1, 1.0.2, 1.0.3 | 2021-07-14 |
|
1.0.4, 1.0.5 | 2021-07-14 |
|
1.0.6 | 2021-07-16 |
|
1.0.7 | 2021-08-03 |
|
Contributions are welcomed and, of course, greatly appreciated.
- Fork the Project.
- Create your Feature Branch (
git checkout -b feature/Feature
) - Commit your Changes (
git commit -m 'Add some Feature'
) - Push to the Branch (
git push origin feature/Feature
) - Open a Pull Request.
Tom Berey; Project Manager, Lead Developer, Principal Tester & Customer Services;
tomberey1@gmail.com;