Skip to content

thomasnorris/Node-Logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

  • Add to another project as a submodule using the instructions here if not done so already.
  • From the Node-Logger submodule:
    • In the config folder:
      • Copy/rename config_template.json to config.json and fill in appropriate settings.
    • In the root folder:
      • Run npm install to install required packages.
      • Run/edit test.js to make sure that all connections are good to go.

Usage

  • Import after all other submodules but before any program code:
      var _path = require('path');
    
      // import other submodules first
    
      var _logger = require(_path.resolve(__dirname, 'Node-Logger', 'app.js'));
    
      // rest of program code goes here
  • _logger.MethodName.Async(...); to log fire-and-forget events.
  • [await] _logger.MethodName.Sync(...).then(...).catch(...); to log events that must be synchronous.
  • It can also be wrapped in an anonymous async function for certain uses (like inside of another callback, shown here)
    function myFunction(callback(value) => {
      // some callback code
    
      (async () => {
        // [await] _logger.MethodName.Sync(...).then(...).catch(...);
    
        // more code to be called once logging is done
      })();
    });

About

NodeJS Submodule for logging events to a Mariadb SQL Server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published