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

vuejs-text-logger

v0.0.6

Published

A simple text logger for Node.js and Vue.js 2.x

Downloads

212

Readme

vuejs-text-logger

node

A very simple logger plugin for Node.js and Vue.js 2.x

With this plugin you can log to a text file all the logs informations that you want as strings, line by line. It is possible to specify a file name, a file path and the maximum size of the log file. If the maximum size of the file is reached, old data will be overwritten with new ones.

Installation

npm install vuejs-text-logger

Usage

On your main.js file of your Vue project, write these lines:

import logger from 'vuejs-text-logger'

Vue.use(logger, options);

where options is an object:

options: {
  logs: true,             // A {boolean} value that indicates if logger must be turned on or off
  logsPath: '',           // A {string} file path where to save the log files
  appendDate: false,	  // A {boolean} value that indicates if a date in a format `DD/MM/YYYY, HH:mm:ss` must be added in front of a log line
  maxFileDimension: 50    // An {integer} indicating the max files dimensions in Megabytes
}

then in your project you can use it as:

this.$logger.saveToLog(fileName, data)

where filename is a string containing the log's filename and data is a string containing every kind of data to be written inside the log file.

You can save your logs'data in more than one log file using this plugin by specifying different filenames to pass at the saveToLog function:

this.$logger.saveToLog('aLogFile.txt', 'This is a log file');
this.$logger.saveToLog('anotherLogFile.txt', 'This is another log file');

then in your logsPath directory you will find two files named aLogFile.txt and anotherLogFile.txt

During the logging if one or more files reach the maxFileDimension specified on plugin intialization, then the plugin provides to overwrite old data.

The saveToLog function will return a boolean value true if the write operations are successful otherwise will return the boolean value false.

Line termination characters \r\n are added automatically at the end of a log line.