pax_global_header00006660000000000000000000000064126564344330014524gustar00rootroot0000000000000052 comment=349e046ea78834c5659beafd9a7c364ebd0ed221 fancy-log-1.2.0/000077500000000000000000000000001265643443300134035ustar00rootroot00000000000000fancy-log-1.2.0/.editorconfig000066400000000000000000000003051265643443300160560ustar00rootroot00000000000000# http://editorconfig.org root = true [*] indent_style = space indent_size = 2 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = false fancy-log-1.2.0/.eslintrc000066400000000000000000000001151265643443300152240ustar00rootroot00000000000000{ "extends": "@phated/iceddev/es5", "rules": { "no-console": 0 } } fancy-log-1.2.0/.gitignore000066400000000000000000000011461265643443300153750ustar00rootroot00000000000000# 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.2.0/.travis.yml000066400000000000000000000002071265643443300155130ustar00rootroot00000000000000sudo: false language: node_js node_js: - '4' - '0.12' - '0.10' before_install: - 'npm install -g npm' # update that devish npm fancy-log-1.2.0/LICENSE000066400000000000000000000022001265643443300144020ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2015 Blaine Bublitz Based on gulp-util, copyright 2014 Fractal 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.2.0/README.md000066400000000000000000000013221265643443300146600ustar00rootroot00000000000000# fancy-log [![Travis Build Status](https://img.shields.io/travis/js-cli/fancy-log.svg?branch=master&label=travis&style=flat-square)](https://travis-ci.org/js-cli/fancy-log) Log things, prefixed with a timestamp __This module was pulled out of gulp-util for use inside the CLI__ ## 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 ths message as if you called `console.error` but prefixes the output with the current time in HH:MM:ss format. ## License MIT fancy-log-1.2.0/index.js000066400000000000000000000011121265643443300150430ustar00rootroot00000000000000'use strict'; /* Initial code from https://github.com/gulpjs/gulp-util/blob/v3.0.6/lib/log.js */ var chalk = require('chalk'); var timestamp = require('time-stamp'); function getTimestamp(){ return '['+chalk.grey(timestamp('HH:mm:ss'))+']'; } function log(){ var time = getTimestamp(); process.stdout.write(time + ' '); console.log.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.error = error; fancy-log-1.2.0/package.json000066400000000000000000000014641265643443300156760ustar00rootroot00000000000000{ "name": "fancy-log", "version": "1.2.0", "description": "Log things, prefixed with a timestamp", "author": "Blaine Bublitz (http://iceddev.com)", "contributors": [], "repository": "phated/fancy-log", "license": "MIT", "engines": { "node": ">= 0.10" }, "main": "index.js", "files": [ "LICENSE", "index.js" ], "scripts": { "test": "lab -cvL test.js" }, "dependencies": { "chalk": "^1.1.1", "time-stamp": "^1.0.0" }, "devDependencies": { "@phated/eslint-config-iceddev": "^0.2.1", "code": "^1.5.0", "eslint": "^1.3.1", "eslint-plugin-mocha": "^0.5.1", "eslint-plugin-react": "^3.3.1", "lab": "^5.16.0" }, "keywords": [ "console.log", "log", "logger", "logging", "pretty", "timestamp" ] } fancy-log-1.2.0/test.js000066400000000000000000000046171265643443300147300ustar00rootroot00000000000000'use strict'; /* Initial code from https://github.com/gulpjs/gulp-util/blob/v3.0.6/test/log.js */ var lab = exports.lab = require('lab').script(); var code = require('code'); var chalk = require('chalk'); var timestamp = require('time-stamp'); var log = require('./'); lab.describe('log()', function(){ var stdout_write = process.stdout.write; var writtenValue = ''; function writeSpy(value) { writtenValue += value; } lab.afterEach(function(done){ writtenValue = ''; done(); }); lab.it('should work i guess', function(done){ // Stub process.stdout.write process.stdout.write = writeSpy; log(1, 2, 3, 4, 'five'); var time = timestamp('HH:mm:ss'); code.expect(writtenValue).equals('[' + chalk.grey(time) + '] 1 2 3 4 \'five\'\n'); // Restore process.stdout.write after test process.stdout.write = stdout_write; done(); }); lab.it('should accept formatting', function(done){ // Stub process.stdout.write process.stdout.write = writeSpy; log('%s %d %j', 'something', 0.1, {key: 'value'}); var time = timestamp('HH:mm:ss'); code.expect(writtenValue).equals( '[' + chalk.grey(time) + '] '+ 'something 0.1 {\"key\":\"value\"}\n' ); // Restore process.stdout.write after test process.stdout.write = stdout_write; done(); }); }); lab.describe('log.error()', function(){ var stderr_write = process.stderr.write; var writtenValue = ''; function writeSpy(value) { writtenValue += value; } lab.afterEach(function(done){ writtenValue = ''; done(); }); lab.it('should work i guess', function(done){ // Stub process.stderr.write process.stderr.write = writeSpy; log.error(1, 2, 3, 4, 'five'); var time = timestamp('HH:mm:ss'); code.expect(writtenValue).equals('[' + chalk.grey(time) + '] 1 2 3 4 \'five\'\n'); // Restore process.stderr.write after test process.stderr.write = stderr_write; done(); }); lab.it('should accept formatting', function(done){ // Stub process.stderr.write process.stderr.write = writeSpy; log.error('%s %d %j', 'something', 0.1, {key: 'value'}); var time = timestamp('HH:mm:ss'); code.expect(writtenValue).equals( '[' + chalk.grey(time) + '] '+ 'something 0.1 {\"key\":\"value\"}\n' ); // Restore process.stderr.write after test process.stderr.write = stderr_write; done(); }); });