pax_global_header00006660000000000000000000000064142554273720014525gustar00rootroot0000000000000052 comment=ad09a43a26cb4b5b88112d61fd86aca6682729c9 glogg-2.0.0/000077500000000000000000000000001425542737200126235ustar00rootroot00000000000000glogg-2.0.0/.editorconfig000066400000000000000000000003261425542737200153010ustar00rootroot00000000000000# 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 glogg-2.0.0/.eslintignore000066400000000000000000000000121425542737200153170ustar00rootroot00000000000000coverage/ glogg-2.0.0/.eslintrc000066400000000000000000000000301425542737200144400ustar00rootroot00000000000000{ "extends": "gulp" } glogg-2.0.0/.gitattributes000066400000000000000000000000161425542737200155130ustar00rootroot00000000000000* text eol=lf glogg-2.0.0/.github/000077500000000000000000000000001425542737200141635ustar00rootroot00000000000000glogg-2.0.0/.github/workflows/000077500000000000000000000000001425542737200162205ustar00rootroot00000000000000glogg-2.0.0/.github/workflows/dev.yml000066400000000000000000000031051425542737200175200ustar00rootroot00000000000000name: dev on: pull_request: push: branches: - master - main env: CI: true jobs: prettier: name: Format code runs-on: ubuntu-latest if: ${{ github.event_name == 'push' }} steps: - name: Checkout uses: actions/checkout@v2 - name: Prettier uses: gulpjs/prettier_action@v3.0 with: commit_message: 'chore: Run prettier' prettier_options: '--write .' test: name: Tests for Node ${{ matrix.node }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: node: [10, 12, 14, 16] os: [ubuntu-latest, windows-latest, macos-latest] steps: - name: Clone repository uses: actions/checkout@v2 - name: Set Node.js version uses: actions/setup-node@v2 with: node-version: ${{ matrix.node }} - run: node --version - run: npm --version - name: Install npm dependencies run: npm install - name: Run lint run: npm run lint - name: Run tests run: npm test - name: Coveralls uses: coverallsapp/github-action@v1.1.2 with: github-token: ${{ secrets.GITHUB_TOKEN }} flag-name: ${{matrix.os}}-node-${{ matrix.node }} parallel: true coveralls: needs: test name: Finish up runs-on: ubuntu-latest steps: - name: Coveralls Finished uses: coverallsapp/github-action@v1.1.2 with: github-token: ${{ secrets.GITHUB_TOKEN }} parallel-finished: true glogg-2.0.0/.github/workflows/release.yml000066400000000000000000000005511425542737200203640ustar00rootroot00000000000000name: release on: push: branches: - master - main jobs: release-please: runs-on: ubuntu-latest steps: - uses: GoogleCloudPlatform/release-please-action@v2 with: token: ${{ secrets.GITHUB_TOKEN }} release-type: node package-name: release-please-action bump-minor-pre-major: true glogg-2.0.0/.gitignore000066400000000000000000000017111425542737200146130ustar00rootroot00000000000000# Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* # Runtime data pids *.pid *.seed *.pid.lock # Directory for instrumented libs generated by jscoverage/JSCover lib-cov # Coverage directory used by tools like istanbul coverage # nyc test coverage .nyc_output # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) .grunt # Bower dependency directory (https://bower.io/) bower_components # node-waf configuration .lock-wscript # Compiled binary addons (https://nodejs.org/api/addons.html) build/Release # Dependency directories node_modules/ jspm_packages/ # TypeScript v1 declaration files typings/ # Optional npm cache directory .npm # Optional eslint cache .eslintcache # Optional REPL history .node_repl_history # Output of 'npm pack' *.tgz # Yarn Integrity file .yarn-integrity # dotenv environment variables file .env # next.js build output .next # Garbage files .DS_Store # Test results test.xunit glogg-2.0.0/.npmrc000066400000000000000000000000231425542737200137360ustar00rootroot00000000000000package-lock=false glogg-2.0.0/.prettierignore000066400000000000000000000000441425542737200156640ustar00rootroot00000000000000coverage/ .nyc_output/ CHANGELOG.md glogg-2.0.0/CHANGELOG.md000066400000000000000000000006361425542737200144410ustar00rootroot00000000000000# Changelog ## [2.0.0](https://www.github.com/gulpjs/glogg/compare/v1.0.2...v2.0.0) (2022-06-24) ### ⚠ BREAKING CHANGES * Normalize repository, dropping node <10.13 support (#5) ### Miscellaneous Chores * Normalize repository, dropping node <10.13 support ([#5](https://www.github.com/gulpjs/glogg/issues/5)) ([8bb6148](https://www.github.com/gulpjs/glogg/commit/8bb6148c061e0f11ea9330924e954c39af7f02b6)) glogg-2.0.0/LICENSE000066400000000000000000000022131425542737200136260ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2014, 2015, 2018, 2022 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. glogg-2.0.0/README.md000066400000000000000000000062451425542737200141110ustar00rootroot00000000000000

# glogg [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] Global logging utility. ## Usage ```js var getLogger = require('glogg'); var logger = getLogger('my-namespace'); // logs strings logger.debug('The MOST verbose!'); logger.info('Some important info'); logger.warn('All the warnings to you'); logger.error('OH NO! SOMETHING HAPPENED!'); // supports util.format! logger.info('%s style!', 'printf'); // log anything logger.debug({ my: 'obj' }); logger.info([1, 2, 3]); // somewhere else logger.on('info', function (msg) { // do something with msg }); // must be handled to avoid crashing process logger.on('error', function (msg) { // now it won't crash }); ``` ## API **Note: This module makes no assumptions about the log levels and they will always be emitted. If you are looking to filter some out, your listeners will need to have extra logic.** ### getLogger([namespace]) Create a new logger at the given namespace (or the default if no namespace is provided). Returns an augmented [`sparkles`](https://github.com/phated/sparkles) EventEmitter object with 4 methods: `debug()`, `info()`, `warn()` and `error()`. When called, these methods emit an event with the same name. If the first argument is a string, the arguments are passed through node's `util.format()` before being emitted. Other parts of a node program can get the logger by namespace and listen for the events to be emitted. #### logger.debug(msg) Emits a `debug` event with the given `msg`. If the first argument is a string, all arguments are passed to node's `util.format()` before being emitted. #### logger.info(msg) Emits a `info` event with the given `msg`. If the first argument is a string, all arguments are passed to node's `util.format()` before being emitted. #### logger.warn(msg) Emits a `warn` event with the given `msg`. If the first argument is a string, all arguments are passed to node's `util.format()` before being emitted. #### logger.error(msg) Emits a `error` event with the given `msg`. If the first argument is a string, all arguments are passed to node's `util.format()` before being emitted. **Note: You must handle this event in some way or the node process will crash when an `error` event is emitted.** #### logger.on(event, fn) Standard API from node's `EventEmitter`. Use this to listen for events from the logger methods. ## License MIT [downloads-image]: https://img.shields.io/npm/dm/glogg.svg?style=flat-square [npm-url]: https://www.npmjs.com/package/glogg [npm-image]: https://img.shields.io/npm/v/glogg.svg?style=flat-square [ci-url]: https://github.com/gulpjs/glogg/actions?query=workflow:dev [ci-image]: https://img.shields.io/github/workflow/status/gulpjs/glogg/dev?style=flat-square [coveralls-url]: https://coveralls.io/r/gulpjs/glogg [coveralls-image]: https://img.shields.io/coveralls/gulpjs/glogg/master.svg?style=flat-square glogg-2.0.0/index.js000066400000000000000000000010241425542737200142650ustar00rootroot00000000000000'use strict'; var format = require('util').format; var sparkles = require('sparkles'); var levels = ['debug', 'info', 'warn', 'error']; function getLogger(namespace) { var logger = sparkles(namespace); levels.forEach(function (level) { logger[level] = makeLogLevel(logger, level); }); return logger; } function makeLogLevel(self, level) { return function (msg) { if (typeof msg === 'string') { msg = format.apply(null, arguments); } self.emit(level, msg); }; } module.exports = getLogger; glogg-2.0.0/package.json000066400000000000000000000016741425542737200151210ustar00rootroot00000000000000{ "name": "glogg", "version": "2.0.0", "description": "Global logging utility", "author": "Gulp Team (http://gulpjs.com/)", "contributors": [ "Blaine Bublitz " ], "repository": "gulpjs/glogg", "license": "MIT", "engines": { "node": ">= 10.13.0" }, "main": "index.js", "files": [ "LICENSE", "index.js" ], "scripts": { "lint": "eslint .", "pretest": "npm run lint", "test": "nyc mocha --async-only" }, "dependencies": { "sparkles": "^2.0.0" }, "devDependencies": { "eslint": "^7.32.0", "eslint-config-gulp": "^5.0.1", "eslint-plugin-node": "^11.1.0", "expect": "^27.4.6", "mocha": "^8.4.0", "nyc": "^15.1.0" }, "nyc": { "reporter": [ "lcov", "text-summary" ] }, "prettier": { "singleQuote": true }, "keywords": [ "global", "log", "logger", "logging", "shared" ] } glogg-2.0.0/test/000077500000000000000000000000001425542737200136025ustar00rootroot00000000000000glogg-2.0.0/test/index.js000066400000000000000000000034221425542737200152500ustar00rootroot00000000000000'use strict'; var expect = require('expect'); var glogg = require('../'); describe('glogg', function () { var logger; beforeEach(function (done) { logger = glogg('glogg-test'); done(); }); afterEach(function (done) { logger.remove(); done(); }); it('emits a debug event when debug method is called', function (done) { logger.on('debug', function (msg) { expect(msg).toEqual('test'); done(); }); logger.debug('test'); }); it('emits a info event when info method is called', function (done) { logger.on('info', function (msg) { expect(msg).toEqual('test'); done(); }); logger.info('test'); }); it('emits a warn event when warn method is called', function (done) { logger.on('warn', function (msg) { expect(msg).toEqual('test'); done(); }); logger.warn('test'); }); it('emits a error event when error method is called', function (done) { logger.on('error', function (msg) { expect(msg).toEqual('test'); done(); }); logger.error('test'); }); it('formats a string message with util.format syntax', function (done) { logger.on('debug', function (msg) { expect(msg).toEqual('test something'); done(); }); logger.debug('test %s', 'something'); }); it('does not format a non-string message', function (done) { var expected = { test: 'something' }; logger.on('debug', function (msg) { expect(msg).toEqual(expected); done(); }); logger.debug(expected); }); it('allows you to "destructure" the individual log-level functions', function (done) { var debug = logger.debug; logger.on('debug', function (msg) { expect(msg).toEqual('test'); done(); }); debug('test'); }); });