1.3.6 • Published 1 year ago

whiz-logger v1.3.6

Weekly downloads
1
License
ISC
Repository
gitlab
Last release
1 year ago

Whiz Logger

Whiz logger for applications based on Winston

Install

npm install whiz-logger

Setup

const logger = require('whiz-logger')({
    environment: "production",
    awsConfig: {
        accessKeyId: process.env.AWS_ACCESS_KEY,
        secretAccessKey: process.env.AWS_SECRET_KEY,
        region: process.env.AWS_REGION,
    },
    projectName: process.env.LOG_GROUP_NAME,
    level: "debug",
    enabledRequestId: true,
});

environment: If it is local, only consoleTransport is enabled.

awsConfig: If the environment is different to local, it is required to set up.

projectName: It is required to works correctly.

level: It is the minimum level allowed logging (debug, warn, info, error).

enabledRequestId: It is necessary use with framework middleware option to initialize the requestId.

Usage

Frameworks

Express Example

// If using with express framework, add the logger middleware right after instantiating express app

const app = express();

// It will log all (request / response), and configure req.id property too
app.use(logger.frameworks.express);

log methods

logger.info("Prueba Info", {anything: true});
// log type: information

logger.warn("Prueba Warn", {anything: true});
// log type: warning

logger.debug("Prueba Debug", {anything: true});
// log type: debug

logger.error("Prueba Error", {anything: true});
// log type: error
1.3.6

1 year ago

1.3.5

2 years ago

1.2.0

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.1.7

3 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago