Skip to content

A Simple and Light-weight txt logging npm module. Log with ease, knowing you captured it all.

License

Notifications You must be signed in to change notification settings

tberey/simple-txt-logger

Repository files navigation

Workflow Issues Version Stargazers Forks Contributors LinkedIn


Logo

SimpleTxtLogger

A simple and lightweight logging module,
by TomCo (Technology & Online Media Company)
NPM Link (Published)
Contents
  1. About
  2. Installation
  3. Usage
  4. Complete Setup Instructions
  5. Changelog
  6. Contributing
  7. Contact
  8. Acknowledgements


About This Project

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.


Tech Stack

  • 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.




Installation

npm install simple-txt-logger




Usage

By default, all .txt log files are placed in a 'logs' folder/directory, which is automatically created in the root folder of the app.

  1. 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.
  1. 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.



Screenshots

Logging Sample
Screenshot#1

Logging Sample#2
Screenshot#2




Roadmap

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




Changelog

Version Date Changes
1.0.0 2021-07-09
  • Initial Commit - Release Day!
  • Add initial directory structure and files.
  • Add Screenshots directory, and images.
  • Create and format README.md
1.0.1, 1.0.2, 1.0.3 2021-07-14
  • NPM Package Release Day!
  • Update all dependencies.
  • Remove old test commands from package.json and codeql.yml.
  • Update README.md.
1.0.4, 1.0.5 2021-07-14
  • NPM Package Release Day!
  • Remove files and folders that are unnecessary to npm.
  • Update README.md.
1.0.6 2021-07-16
  • Update package.json
  • Add npm keywords.
  • Update README.md.
1.0.7 2021-08-03
  • Update linked in url, in README.md.




Contributing

Contributions are welcomed and, of course, greatly appreciated.

  1. Fork the Project.
  2. Create your Feature Branch (git checkout -b feature/Feature)
  3. Commit your Changes (git commit -m 'Add some Feature')
  4. Push to the Branch (git push origin feature/Feature)
  5. Open a Pull Request.




Contact

Tom Berey; Project Manager, Lead Developer, Principal Tester & Customer Services;
[email protected];


Acknowledgements




TomCo™ (Technology & Online Media Company ©)