Skip to content

Commit

Permalink
Merge pull request #11 from Alethio/v2.4.21
Browse files Browse the repository at this point in the history
V2.4.21
  • Loading branch information
baxy authored Apr 2, 2019
2 parents c486bd2 + f00794e commit 601279a
Show file tree
Hide file tree
Showing 5 changed files with 421 additions and 946 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## [2.4.21] - 2019-04-02
- Remove "sprintf" npm package due to memory leaks
- Update npm dependent packages to latest versions

## [2.4.20] - 2019-03-27
- Update register text and readme file

Expand Down
9 changes: 1 addition & 8 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const path = require('path');
const del = require('del');
const gulp = require('gulp');
const plumber = require('gulp-plumber');
const babel = require('gulp-babel');
const eslint = require('gulp-eslint');
const excludeGitignore = require('gulp-exclude-gitignore');
const coveralls = require('gulp-coveralls');

// Initialize the babel transpiler so ES2015 files gets compiled when they're loaded
require('@babel/register');
Expand All @@ -23,11 +21,6 @@ gulp.task('watch', function () {
gulp.watch(['lib/**/*.js', 'test/**'], ['test']);
});

gulp.task('coveralls', function () {
return gulp.src(path.join(__dirname, 'coverage/lcov.info'))
.pipe(coveralls());
});

gulp.task('clean', function () {
return del('dist');
});
Expand All @@ -41,4 +34,4 @@ gulp.task('babel', () => {

gulp.task('prepare', gulp.series('clean', 'babel'));

gulp.task('default', gulp.series('lint', 'coveralls'));
gulp.task('default', gulp.series('lint'));
12 changes: 5 additions & 7 deletions lib/Logger.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import chalk from 'chalk';
import sprintfJS from 'sprintf-js';

export default class Logger {
constructor(options) {
Expand All @@ -11,29 +10,28 @@ export default class Logger {
this.showDebugs = (options.showDebugs === undefined) ? true : options.showDebugs;

this.chalk = chalk;
this.sprintf = sprintfJS.sprintf;
}

_log(type, string, beginWithNewLine = false, processExit = false) {
let dateTime = new Date().toISOString().replace('T', ' ').replace('Z', '');
let newLine = beginWithNewLine ? '\n' : '';
let resultString = `${newLine}${(this.showDateTime) ? dateTime + ' - ' : ''}%s: ${string}`;
let resultString = `${newLine}${(this.showDateTime) ? dateTime + ' - ' : ''}%LOG-TYPE%: ${string}`;

switch (type) {
case 'echo':
console.log(string);
break;
case 'info':
console.log(this.chalk.white(this.sprintf(resultString, 'INFO')));
console.log(this.chalk.white(resultString.replace('%LOG-TYPE%', 'INFO')));
break;
case 'debug':
console.log(this.chalk.cyan(this.sprintf(resultString, 'DEBUG')));
console.log(this.chalk.cyan(resultString.replace('%LOG-TYPE%', 'DEBUG')));
break;
case 'warning':
console.log(this.chalk.yellow(this.sprintf(resultString, 'WARNING')));
console.log(this.chalk.yellow(resultString.replace('%LOG-TYPE%', 'WARNING')));
break;
case 'error':
console.log(this.chalk.red(this.sprintf(resultString, 'ERROR')));
console.log(this.chalk.red(resultString.replace('%LOG-TYPE%', 'ERROR')));
break;
default:
console.log('Unknown log type');
Expand Down
Loading

0 comments on commit 601279a

Please sign in to comment.