2.3.5 • Published 3 years ago

sign-logger v2.3.5

Weekly downloads
78
License
AGPL-3.0-or-later
Repository
github
Last release
3 years ago

Sign-Logger

The best JS/TS logger out there, with everything that you need; ExpressJS, typeorm etc.

Table of contents:

What's new

TypeOrm, ExpressJS and Mongoose support is here!

After almost 10 months without updates, sign-logger is finally getting an update! This update will be primarily focused at: 1. Adding support for TypeOrm Query logging (see here for more information) 2. Adding support for Express logging (see here for more information) 2. Adding support for Mongoose logging (see here for more information) 3. Deciding if the Transformer should be kept in the library or not 4. Clean up & Bug fixes

If you used sign logger before, you might not recognize the new style of code being used, this revamp was made due to the author not being happy with the looks and mechanics.
  1. Sign logger is now split into two classes - Logger and the Transformer! (See the difference here)
  2. The logger also comes with internal logs for debugging (optional)
  3. New fail-safe for possible undefined objects/properties
  4. No constructor, instead the logger uses methods to customize the logs

Installation

npm install sign-logger

Getting started

Simple error log ES6:

import { Logger } from "sign-logger";

const logger = new Logger();
logger.error("BEEP BOOP! ERROR!"); // [2020-11-27 16:55]  <Error>  BEEP BOOP! ERROR!

Transform usage

import { Transformer } from "sign-logger";

const transformer = new Transformer();
console.log(transformer.error("This RETURNS the value, it does not log it!")); // [2020-11-27 16:55]  <Error>  This RETURNS the value, it does not log it!

Express

import { Logger } from "sign-logger";
import express from "express";

const app = express();
const logger = new Logger();

app.use(logger.ExpressJS());

app.get("/", (req, res) => {
    res.send("Hello world!");
})

app.listen(8080, () => logger.info("Server listening on 8080!"));

Now go to localhost:8080 and bam! The request has been logged

TypeOrm

import { Logger } from "sign-logger";
import { createConnection } from "typeorm";

const logger = new Logger();

createConnection({
    logger: logger.TypeOrmLogger
    // ...
})

That's it!

Mongoose

import { Logger } from "sign-Logger";
import mongoose from "mongoose";

const logger = new Logger();

mongoose.set("debug", logger.Mongoose())
// ...

That's all you need! Note: This has not been fully tested yet, so expect bugs and please report them here

Changelog

  • 2.3.5

Added support for mongoose logging, have any suggestions on other libs we can support? Tell us in an issue!

  • 2.3.4

Changed the way you call <Logger>.ExpressJS and changed the license. TODO: Add different modes of logging

  • 2.3.3

Removed an internal debugging log

  • 2.3.2

Bug fixes for ExpressJS involving problems with this

Authors

Collbrothers

2.3.5

3 years ago

2.3.2

3 years ago

2.3.4

3 years ago

2.3.3

3 years ago

2.3.0

3 years ago

2.3.1

3 years ago

2.2.5

3 years ago

2.2.6

3 years ago

2.2.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.9

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago