npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

camel-logger

v2.0.1-0

Published

A package for saving program logs to a file

Downloads

1

Readme

camel-logger - NodeJS file logger

npm version NPM

What New Version 2.0.0

  • The module has been rewritten in TypeScript

Install:

npm i camel-logger

Just require it

const { Logger } = require('camel-logger');
const logger = new Logger('log/log_file.txt'); // Log file directory

Main function

await logger.group('Group log');
await logger.line();
await logger.log('Log .log');
await logger.text('Log .text');
await logger.delimiter();
await logger.groupEnd('Group log');
// logger.groupend('Group log') // alias

// ----- [GROUP]: Group log -----
// [2022-06-09T00:38:58.862Z][L]: -------------------------
// [2022-06-09T00:38:58.865Z][L]: Log .log
// [2022-06-09T00:38:58.866Z][L]: Log .text
// [2022-06-09T00:38:58.869Z][L]: -------------------------
// ----- [GROUPEND]: Group log -----

await logger.line();
await logger.delimiter(); // alias
await logger.separator(); // alias
// [2022-06-09T00:38:58.871Z][L]: -------------------------
// [2022-06-09T00:38:58.872Z][L]: -------------------------
// [2022-06-09T00:38:58.874Z][L]: -------------------------

await logger.empty();
await logger.blank();
await logger.null();
//
//
//

await logger.log('Log .log');
await logger.logging('Log .log'); // alias
await logger.text('Log .log'); // alias
await logger.l('Log .log'); // alias
// [2022-06-09T00:38:58.881Z][L]: Log .log
// [2022-06-09T00:38:58.882Z][L]: Log .log
// [2022-06-09T00:38:58.884Z][L]: Log .log
// [2022-06-09T00:38:58.885Z][L]: Log .log

await logger.info('Log .info');
await logger.information('Log .info'); // alias
await logger.i('Log .info'); // alias
// [2022-06-09T00:38:58.887Z][I]: Log .info
// [2022-06-09T00:38:58.888Z][I]: Log .info
// [2022-06-09T00:38:58.889Z][I]: Log .info

await logger.error('Log .error');
await logger.err('Log .error');
await logger.e('Log .error');
// [2022-06-09T00:38:58.890Z][E]: Log .error
// [2022-06-09T00:38:58.928Z][E]: Log .error
// [2022-06-09T00:38:58.931Z][E]: Log .error

const json = {
  strict: { column: { age: 24, name: 'Yury', job: 'Developer' } },
}; // logger.dev, logger.json
await logger.dev('Log .dev'); // No record log file
await logger.developer('Log .dev'); // No record log file / alias
await logger.d('Log .dev'); // No record log file / alias
// [2022-06-09T00:38:58.933Z][D]: Log .dev
// [2022-06-09T00:38:58.933Z][D]: Log .dev
// [2022-06-09T00:38:58.934Z][D]: Log .dev

await logger.dev(json, true); // true - on mode JSON.STRINGIFY / No record log file
await logger.developer(json, true); // true - on mode JSON.STRINGIFY / No record log file / alias
await logger.d(json, true); // true - on mode JSON.STRINGIFY / No record log file / alias
// [2022-06-09T00:38:58.934Z][D]: {
//     "strict": {
//             "column": {
//                     "age": 24,
//                     "name": "Yury",
//                     "job": "Developer"
//             }
//     }
// }
// [2022-06-09T00:38:58.936Z][D]: {
//     "strict": {
//             "column": {
//                     "age": 24,
//                     "name": "Yury",
//                     "job": "Developer"
//             }
//     }
// }
// [2022-06-09T00:38:58.938Z][D]: {
//     "strict": {
//             "column": {
//                     "age": 24,
//                     "name": "Yury",
//                     "job": "Developer"
//             }
//     }
// }
// [2022-06-09T00:38:58.940Z][JSON]: {
//     "strict": {
//             "column": {
//                     "age": 24,
//                     "name": "Yury",
//                     "job": "Developer"
//             }
//     }
// }

await logger.json(json); // No record log file
await logger.stringify(json); // No record log file / alias
// [2022-06-09T00:38:58.940Z][JSON]: {
//     "strict": {
//             "column": {
//                     "age": 24,
//                     "name": "Yury",
//                     "job": "Developer"
//             }
//     }
// }
// [2022-06-09T00:38:58.942Z][JSON]: {
//     "strict": {
//             "column": {
//                     "age": 24,
//                     "name": "Yury",
//                     "job": "Developer"
//             }
//     }
// }

Change Log

v1.1.1

logger.group('group alias');
logger.delimiter(); // alias line
logger.separator(); // alias line
logger.blank(); // alias empty
logger.null(); // alias empty
logger.space(); // alias empty
logger.logging('log alias'); // alias log
logger.text('log alias'); // alias log
logger.l('log alias'); // alias log
logger.information('info alias'); // alias info
logger.i('info alias'); // alias info
logger.err('error alias'); // alias error
logger.e('error alias'); // alias error
logger.developer(json, true); // alias dev
logger.stringify(json); // alias json
logger.groupEnd('group alias');
//-- logger.groupend('group alias') //alias groupEnd
// ----- [group]: group alias -----
//   [2021-08-18T17:45:10.304Z][L]: -------------------------
//   [2021-08-18T17:45:10.305Z][L]: -------------------------
//
//
//
//   [2021-08-18T17:45:10.307Z][L]: log alias
//   [2021-08-18T17:45:10.307Z][L]: log alias
//   [2021-08-18T17:45:10.308Z][L]: log alias
//   [2021-08-18T17:45:10.308Z][I]: info alias
//   [2021-08-18T17:45:10.309Z][I]: info alias
//   [2021-08-18T17:45:10.309Z][E]: error alias
//   [2021-08-18T17:45:10.309Z][E]: error alias
//   [2021-08-18T17:45:10.310Z][D]: {
//         "strict": {
//                 "column": {
//                         "age": 24,
//                         "name": "Yury",
//                         "job": "Developer"
//                 }
//         }
//   }
//   [2021-08-18T17:45:10.312Z][D]: {
//         "strict": {
//                 "column": {
//                         "age": 24,
//                         "name": "Yury",
//                         "job": "Developer"
//                 }
//         }
//   }
//   [2021-08-18T17:45:10.314Z][JSON]: {
//         "strict": {
//                 "column": {
//                         "age": 24,
//                         "name": "Yury",
//                         "job": "Developer"
//                 }
//         }
//   }
//   ----- [groupEnd]: group alias -----

Attention! Notice

You use this module at your own risk.
This module is delivered "as is".