mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-05-20 00:06:24 +08:00
Update winstonjs
This commit is contained in:
@@ -58,7 +58,7 @@ export function getDecoratorArgs(decorator: any) {
|
||||
break;
|
||||
|
||||
default:
|
||||
Logger.error('Unexpected property value type: ', prop.initializer.kind);
|
||||
Logger.debug('Unexpected property value type: ' + prop.initializer.kind);
|
||||
throw 'Unexpected property value type << helpers.ts >>';
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { transformMembers } from './members';
|
||||
|
||||
function transformClass(cls: any, ngcBuild?: boolean) {
|
||||
|
||||
Logger.profile((ngcBuild ? '[ngc]' : '[esm]') + 'transformClass: ' + cls.name.text);
|
||||
Logger.profile('transformClass: ' + cls.name.text);
|
||||
|
||||
const pluginStatics = [];
|
||||
const dec: any = getDecorator(cls);
|
||||
@@ -38,17 +38,16 @@ function transformClass(cls: any, ngcBuild?: boolean) {
|
||||
]
|
||||
);
|
||||
|
||||
Logger.profile((ngcBuild ? '[ngc]' : '[esm]') + 'transformClass' + cls.name.text);
|
||||
Logger.profile('transformClass: ' + cls.name.text, { level: 'verbose' });
|
||||
return cls;
|
||||
}
|
||||
|
||||
function transformClasses(file: ts.SourceFile, ctx: ts.TransformationContext, ngcBuild?: boolean) {
|
||||
// console.log('Transforming file: ' + file.fileName);
|
||||
Logger.silly('Transforming file: ' + file.fileName);
|
||||
return ts.visitEachChild(file, node => {
|
||||
if (node.kind !== ts.SyntaxKind.ClassDeclaration) {
|
||||
return node;
|
||||
}
|
||||
|
||||
return transformClass(node, ngcBuild);
|
||||
}, ctx);
|
||||
}
|
||||
@@ -58,8 +57,7 @@ export function pluginClassTransformer(ngcBuild?: boolean): ts.TransformerFactor
|
||||
return tsSourceFile => {
|
||||
if (tsSourceFile.fileName.indexOf('src/@ionic-native/plugins') > -1)
|
||||
return transformClasses(tsSourceFile, ctx, ngcBuild);
|
||||
|
||||
return tsSourceFile;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
+9
-20
@@ -1,24 +1,13 @@
|
||||
import * as winston from 'winston';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { createLogger, transports, format } from 'winston';
|
||||
const { label, printf, prettyPrint, combine, colorize, simple } = format;
|
||||
|
||||
const LOG_LEVEL = 'debug';
|
||||
const LOG_LEVEL = 'silly';
|
||||
|
||||
export const Logger = new winston.Logger({
|
||||
export const Logger = createLogger({
|
||||
level: LOG_LEVEL,
|
||||
transports: [
|
||||
new winston.transports.Console({
|
||||
level: 'debug',
|
||||
formatter: (opts: any) => {
|
||||
if (opts.meta) {
|
||||
if (typeof opts.meta['durationMs'] === 'number') {
|
||||
opts.message += ' ' + opts.meta['durationMs'] + 'ms';
|
||||
delete opts.meta['durationMs'];
|
||||
}
|
||||
if (!isEmpty(opts.meta)) console.log(opts.meta);
|
||||
}
|
||||
return winston.config.colorize(opts.level, opts.level.toUpperCase()) + ' ' + opts.message;
|
||||
}
|
||||
})
|
||||
]
|
||||
format: combine(
|
||||
colorize(),
|
||||
simple(),
|
||||
),
|
||||
transports: [new transports.Console({ level: LOG_LEVEL })]
|
||||
});
|
||||
|
||||
|
||||
@@ -69,11 +69,10 @@ function createIndexFile() {
|
||||
function compile() {
|
||||
Logger.profile('build-es5');
|
||||
webpack(webpackConfig, (err, stats) => {
|
||||
Logger.profile('build-es5');
|
||||
Logger.profile('build-es5', { level: 'verbose' });
|
||||
if (err) Logger.error('Error occurred while compiling with Webpack', err);
|
||||
else {
|
||||
Logger.info('Compiled ES5 file with Webpack successfully.');
|
||||
// Logger.verbose('Webpack complete', stats, () => {});
|
||||
}
|
||||
cleanEmittedData();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user