Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getLogger() {
let logger = new Signale({ interactive: false });
logger.config({
displayTimestamp: true
});
if (process.env.DEBUG) {
let consoleLog = console.log;
// consoleLog = function() {};
logger = {
success: consoleLog,
await: consoleLog,
watch: consoleLog,
fatal: consoleLog,
info: consoleLog,
time: consoleLog,
timeEnd: consoleLog
}
import * as fs from 'fs'
import * as path from 'path'
import { inspect } from 'util'
import { Signale } from 'signale'
// eslint-disable-next-line no-unused-vars
import { PlatformSelector, IDBusConnection, PlatformClient } from 'yoda-platform-lib'
export const signale = new Signale({
types: {
verbose: {
badge: '> ',
color: 'grey',
label: 'verbose'
}
}
})
if (!process.stdout.isTTY) {
signale.disable()
}
export function omit (object: object, ...keys: string[]) {
if (object == null) {
return object
private wrapLogger (logger?: Signale) {
if (!logger) logger = new Signale({ config: { underlineLabel: false } })
// Create a callable function
const fn = logger.info.bind(logger)
// Add the log methods onto the function
const wrapped = Object.assign(fn, logger)
// Clone the prototype
Object.setPrototypeOf(wrapped, logger)
return wrapped
}
async function getUserAuth(consumerKey, consumerSecret) {
const log = new Signale({ interactive: true });
const oauth = new Flickr.OAuth(consumerKey, consumerSecret);
try {
log.await("Requesting authorization token");
const { body } = await oauth.request("");
log.success(
"Authorization token retrieved",
body.oauth_token,
body.oauth_token_secret
);
return Flickr.OAuth.createPlugin(
consumerKey,
consumerSecret,
body.oauth_token,
body.oauth_token_secret
},
browserslist: [
'> 1%',
'last 1 versions',
'not ie 11',
'not dead'
],
devDependencies: {
'@astronomersiva/lego': `^${version}`
}
};
fs.writeFileSync(`${sitePath}/package.json`, JSON.stringify(packageJson, null, 2));
logger.info(`Successfully generated project ${chalk.cyan(site)}.`);
let cmdLogger = new Signale();
cmdLogger.info(`Run ${chalk.cyan(`cd ${sitePath}`)} followed by ${chalk.cyan('lego s')} to start the development server.`);
} catch (error) {
throw error;
}
}
import { Signale } from "signale";
const logger = new Signale({ disabled: true });
(logger as any).Signale = Signale;
export = logger;
label: '失败'
},
success: {
badge: ' 🎉 ',
color: 'green',
label: '成功'
},
info: {
badge: '',
color: '',
label: ''
}
}
};
const signale = new Signale(options);
module.exports = {
success: function (msg) {
signale.success(chalk.green(msg));
},
error: function (msg) {
signale.error(chalk.red(msg));
},
info: function (msg) {
signale.info(chalk.green(msg));
},
loading: (title = '加载中...') => {
spinner.setSpinnerTitle(` 💫 ${title} %s`);
spinner.setSpinnerString('⣾⣽⣻⢿⡿⣟⣯⣷');
spinner.start();
export function getInteractiveLogger() {
const interactive = new logger.Signale({
interactive: true,
config: {
displayTimestamp: true
}
});
return interactive;
}
const {Signale} = require('signale');
module.exports = {
global: new Signale({scope: 'Global '}),
migrate: new Signale({scope: 'Migrate '}),
express: new Signale({scope: 'Express '}),
registry: new Signale({scope: 'Registry'}),
};
logInteractiveSync(scope, func) {
const INTERACTIVE_LOGGER = new signale.Signale({
interactive: true
});
INTERACTIVE_LOGGER.scope(this.toStringSafe(scope));
try {
return func.apply(this.generator,
[ INTERACTIVE_LOGGER ]);
} finally {
INTERACTIVE_LOGGER.unscope();
process.stdout.write(
os.EOL
);
}
}