pax_global_header00006660000000000000000000000064134000730570014511gustar00rootroot0000000000000052 comment=d17973c9c69b69aee0caa63469c9275fc9b4b387 fancy-log-1.3.3/000077500000000000000000000000001340007305700133745ustar00rootroot00000000000000fancy-log-1.3.3/.editorconfig000066400000000000000000000003261340007305700160520ustar00rootroot00000000000000# http://editorconfig.org root = true [*] indent_style = space indent_size = 2 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true end_of_line = lf [*.md] trim_trailing_whitespace = false fancy-log-1.3.3/.eslintrc000066400000000000000000000000761340007305700152230ustar00rootroot00000000000000{ "extends": "gulp", "rules": { "no-console": 0 } } fancy-log-1.3.3/.gitattributes000066400000000000000000000000161340007305700162640ustar00rootroot00000000000000* text eol=lf fancy-log-1.3.3/.gitignore000066400000000000000000000011461340007305700153660ustar00rootroot00000000000000# Logs logs *.log # Runtime data pids *.pid *.seed # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) .grunt # Compiled binary addons (http://nodejs.org/api/addons.html) build/Release # Dependency directory # Commenting this out is preferred by some people, see # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- node_modules # Users Environment Variables .lock-wscript # Garbage files .DS_Store fancy-log-1.3.3/.npmrc000066400000000000000000000000231340007305700145070ustar00rootroot00000000000000package-lock=false fancy-log-1.3.3/.travis.yml000066400000000000000000000002021340007305700154770ustar00rootroot00000000000000sudo: false language: node_js node_js: - '10' - '8' - '6' - '4' - '0.12' - '0.10' after_script: - npm run coveralls fancy-log-1.3.3/LICENSE000066400000000000000000000022051340007305700144000ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2014, 2015, 2018 Blaine Bublitz and Eric Schoffstall Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. fancy-log-1.3.3/README.md000066400000000000000000000040221340007305700146510ustar00rootroot00000000000000

# fancy-log [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] Log things, prefixed with a timestamp. ## Usage ```js var log = require('fancy-log'); log('a message'); // [16:27:02] a message log.error('oh no!'); // [16:27:02] oh no! ``` ## API ### `log(msg...)` Logs the message as if you called `console.log` but prefixes the output with the current time in HH:MM:ss format. ### `log.error(msg...)` Logs the message as if you called `console.error` but prefixes the output with the current time in HH:MM:ss format. ### `log.warn(msg...)` Logs the message as if you called `console.warn` but prefixes the output with the current time in HH:MM:ss format. ### `log.info(msg...)` Logs the message as if you called `console.info` but prefixes the output with the current time in HH:MM:ss format. ### `log.dir(msg...)` Logs the message as if you called `console.dir` but prefixes the output with the current time in HH:MM:ss format. ## License MIT [downloads-image]: http://img.shields.io/npm/dm/fancy-log.svg [npm-url]: https://www.npmjs.com/package/fancy-log [npm-image]: http://img.shields.io/npm/v/fancy-log.svg [travis-url]: https://travis-ci.org/gulpjs/fancy-log [travis-image]: http://img.shields.io/travis/gulpjs/fancy-log.svg?label=travis-ci [appveyor-url]: https://ci.appveyor.com/project/gulpjs/fancy-log [appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/fancy-log.svg?label=appveyor [coveralls-url]: https://coveralls.io/r/gulpjs/fancy-log [coveralls-image]: http://img.shields.io/coveralls/gulpjs/fancy-log/master.svg [gitter-url]: https://gitter.im/gulpjs/gulp [gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg fancy-log-1.3.3/appveyor.yml000066400000000000000000000007541340007305700157720ustar00rootroot00000000000000# http://www.appveyor.com/docs/appveyor-yml # http://www.appveyor.com/docs/lang/nodejs-iojs environment: matrix: # node.js - nodejs_version: "0.10" - nodejs_version: "0.12" - nodejs_version: "4" - nodejs_version: "6" - nodejs_version: "8" - nodejs_version: "10" install: - ps: Install-Product node $env:nodejs_version - npm install test_script: - node --version - npm --version - cmd: npm test build: off # build version format version: "{build}" fancy-log-1.3.3/index.js000066400000000000000000000041121340007305700150370ustar00rootroot00000000000000'use strict'; var Console = require('console').Console; var gray = require('ansi-gray'); var timestamp = require('time-stamp'); var supportsColor = require('color-support'); var nodeVersion = require('parse-node-version')(process.version); var colorDetectionOptions = { // If on Windows, ignore the isTTY check // This is due to AppVeyor (and thus probably common Windows platforms?) failing the check // TODO: If this is too broad, we can reduce it to an APPVEYOR env check ignoreTTY: (process.platform === 'win32'), }; // Needed to add this because node 10 decided to start coloring log output randomly var console; if (nodeVersion.major >= 10) { // Node 10 also changed the way this is constructed console = new Console({ stdout: process.stdout, stderr: process.stderr, colorMode: false, }); } else { console = new Console(process.stdout, process.stderr); } function hasFlag(flag) { return (process.argv.indexOf('--' + flag) !== -1); } function addColor(str) { if (hasFlag('no-color')) { return str; } if (hasFlag('color')) { return gray(str); } if (supportsColor(colorDetectionOptions)) { return gray(str); } return str; } function getTimestamp() { return '[' + addColor(timestamp('HH:mm:ss')) + ']'; } function log() { var time = getTimestamp(); process.stdout.write(time + ' '); console.log.apply(console, arguments); return this; } function info() { var time = getTimestamp(); process.stdout.write(time + ' '); console.info.apply(console, arguments); return this; } function dir() { var time = getTimestamp(); process.stdout.write(time + ' '); console.dir.apply(console, arguments); return this; } function warn() { var time = getTimestamp(); process.stderr.write(time + ' '); console.warn.apply(console, arguments); return this; } function error() { var time = getTimestamp(); process.stderr.write(time + ' '); console.error.apply(console, arguments); return this; } module.exports = log; module.exports.info = info; module.exports.dir = dir; module.exports.warn = warn; module.exports.error = error; fancy-log-1.3.3/package.json000066400000000000000000000021641340007305700156650ustar00rootroot00000000000000{ "name": "fancy-log", "version": "1.3.3", "description": "Log things, prefixed with a timestamp.", "author": "Gulp Team (http://gulpjs.com/)", "contributors": [ "Blaine Bublitz ", "Aman Mittal (http://amandeepmittal.github.io/)" ], "repository": "gulpjs/fancy-log", "license": "MIT", "engines": { "node": ">= 0.10" }, "main": "index.js", "files": [ "LICENSE", "index.js" ], "scripts": { "lint": "eslint .", "pretest": "npm run lint", "test": "mocha --async-only", "cover": "istanbul cover _mocha --report lcovonly", "coveralls": "npm run cover && istanbul-coveralls" }, "dependencies": { "ansi-gray": "^0.1.1", "color-support": "^1.1.3", "parse-node-version": "^1.0.0", "time-stamp": "^1.0.0" }, "devDependencies": { "eslint": "^2.13.0", "eslint-config-gulp": "^3.0.1", "expect": "^1.20.2", "istanbul": "^0.4.3", "istanbul-coveralls": "^1.0.3", "mocha": "^3.5.3" }, "keywords": [ "console.log", "log", "logger", "logging", "pretty", "timestamp" ] } fancy-log-1.3.3/test/000077500000000000000000000000001340007305700143535ustar00rootroot00000000000000fancy-log-1.3.3/test/.eslintrc000066400000000000000000000000351340007305700161750ustar00rootroot00000000000000{ "extends": "gulp/test" } fancy-log-1.3.3/test/index.js000066400000000000000000000114741340007305700160270ustar00rootroot00000000000000'use strict'; var util = require('util'); var expect = require('expect'); var gray = require('ansi-gray'); var timestamp = require('time-stamp'); var log = require('../'); var stdoutSpy = expect.spyOn(process.stdout, 'write').andCallThrough(); var stderrSpy = expect.spyOn(process.stderr, 'write').andCallThrough(); describe('log()', function() { var term = process.env.TERM; var colorterm = process.env.COLORTERM; beforeEach(function(done) { stdoutSpy.reset(); done(); }); it('should work i guess', function(done) { log(1, 2, 3, 4, 'five'); var time = timestamp('HH:mm:ss'); expect(stdoutSpy.calls[0].arguments).toInclude('[' + gray(time) + '] '); expect(stdoutSpy.calls[1].arguments).toInclude('1 2 3 4 \'five\'\n'); done(); }); it('should accept formatting', function(done) { log('%s %d %j', 'something', 0.1, { key: 'value' }); var time = timestamp('HH:mm:ss'); expect(stdoutSpy.calls[0].arguments).toInclude('[' + gray(time) + '] '); expect(stdoutSpy.calls[1].arguments).toInclude('something 0.1 {\"key\":\"value\"}\n'); done(); }); it('does not add color if argv contains --no-color', function(done) { process.argv.push('--no-color'); log(1, 2, 3, 4, 'five'); var time = timestamp('HH:mm:ss'); expect(stdoutSpy.calls[0].arguments).toInclude('[' + time + '] '); expect(stdoutSpy.calls[1].arguments).toInclude('1 2 3 4 \'five\'\n'); process.argv.pop(); done(); }); it('adds color if argv contains --color', function(done) { process.argv.push('--color'); log(1, 2, 3, 4, 'five'); var time = timestamp('HH:mm:ss'); expect(stdoutSpy.calls[0].arguments).toInclude('[' + gray(time) + '] '); expect(stdoutSpy.calls[1].arguments).toInclude('1 2 3 4 \'five\'\n'); process.argv.pop(); done(); }); it('does not add color if no support', function(done) { process.env.TERM = 'dumb'; delete process.env.COLORTERM; log(1, 2, 3, 4, 'five'); var time = timestamp('HH:mm:ss'); expect(stdoutSpy.calls[0].arguments).toInclude('[' + time + '] '); expect(stdoutSpy.calls[1].arguments).toInclude('1 2 3 4 \'five\'\n'); process.env.TERM = term; process.env.COLORTERM = colorterm; done(); }); }); describe('log.info()', function() { beforeEach(function(done) { stdoutSpy.reset(); done(); }); it('should work i guess', function(done) { log.info(1, 2, 3, 4, 'five'); var time = timestamp('HH:mm:ss'); expect(stdoutSpy.calls[0].arguments).toInclude('[' + gray(time) + '] '); expect(stdoutSpy.calls[1].arguments).toInclude('1 2 3 4 \'five\'\n'); done(); }); it('should accept formatting', function(done) { log.info('%s %d %j', 'something', 0.1, { key: 'value' }); var time = timestamp('HH:mm:ss'); expect(stdoutSpy.calls[0].arguments).toInclude('[' + gray(time) + '] '); expect(stdoutSpy.calls[1].arguments).toInclude('something 0.1 {\"key\":\"value\"}\n'); done(); }); }); describe('log.dir()', function() { beforeEach(function(done) { stdoutSpy.reset(); done(); }); it('should format an object with util.inspect', function(done) { log.dir({ key: 'value' }); var time = timestamp('HH:mm:ss'); expect(stdoutSpy.calls[0].arguments).toInclude('[' + gray(time) + '] '); expect(stdoutSpy.calls[1].arguments).toInclude(util.inspect({ key: 'value' }) + '\n'); done(); }); }); describe('log.warn()', function() { beforeEach(function(done) { stderrSpy.reset(); done(); }); it('should work i guess', function(done) { log.warn(1, 2, 3, 4, 'five'); var time = timestamp('HH:mm:ss'); expect(stderrSpy.calls[0].arguments).toInclude('[' + gray(time) + '] '); expect(stderrSpy.calls[1].arguments).toInclude('1 2 3 4 \'five\'\n'); done(); }); it('should accept formatting', function(done) { log.warn('%s %d %j', 'something', 0.1, { key: 'value' }); var time = timestamp('HH:mm:ss'); expect(stderrSpy.calls[0].arguments).toInclude('[' + gray(time) + '] '); expect(stderrSpy.calls[1].arguments).toInclude('something 0.1 {\"key\":\"value\"}\n'); done(); }); }); describe('log.error()', function() { beforeEach(function(done) { stderrSpy.reset(); done(); }); it('should work i guess', function(done) { log.error(1, 2, 3, 4, 'five'); var time = timestamp('HH:mm:ss'); expect(stderrSpy.calls[0].arguments).toInclude('[' + gray(time) + '] '); expect(stderrSpy.calls[1].arguments).toInclude('1 2 3 4 \'five\'\n'); done(); }); it('should accept formatting', function(done) { log.error('%s %d %j', 'something', 0.1, { key: 'value' }); var time = timestamp('HH:mm:ss'); expect(stderrSpy.calls[0].arguments).toInclude('[' + gray(time) + '] '); expect(stderrSpy.calls[1].arguments).toInclude('something 0.1 {\"key\":\"value\"}\n'); done(); }); });