本文整理汇总了TypeScript中log-cool.logWarn函数的典型用法代码示例。如果您正苦于以下问题:TypeScript logWarn函数的具体用法?TypeScript logWarn怎么用?TypeScript logWarn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logWarn函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: checkDependency
function checkDependency(serviceName: string, command: string, transform: (x: string) => string): void {
try {
const x = execSync(command, { stdio: ['pipe', 'pipe', 'ignore'] });
const ver = transform(x.toString());
if (ver !== null) {
logInfo(`${serviceName} ${ver}`);
} else {
logWarn(`Check dependencies error (${serviceName})`);
logWarn(`Regexp used for version check of ${serviceName} is probably messed up`);
}
} catch (e) {
logWarn(`Unable to find (${serviceName})`);
}
}
开发者ID:Tosuke,项目名称:Misskey-API,代码行数:14,代码来源:check-dependencies.ts
示例2: init
/**
* Init app
*/
async function init(): Promise<State> {
console.log('Welcome to Misskey!\n');
console.log(chalk.bold('Misskey Core <aoi>'));
let warn = false;
// Get commit info
const commit = await prominence(git).getLastCommit();
console.log(`commit: ${commit.shortHash} ${commit.author.name} <${commit.author.email}>`);
console.log(` ${new Date(parseInt(commit.committedOn, 10) * 1000)}`);
console.log('\nInitializing...\n');
if (IS_DEBUG) {
logWarn('It is not in the Production mode. Do not use in the Production environment.');
}
logInfo(`environment: ${env}`);
// Get machine info
const totalmem = (os.totalmem() / 1024 / 1024 / 1024).toFixed(1);
const freemem = (os.freemem() / 1024 / 1024 / 1024).toFixed(1);
logInfo(`MACHINE: ${os.hostname()}`);
logInfo(`MACHINE: CPU: ${os.cpus().length}core`);
logInfo(`MACHINE: MEM: ${totalmem}GB (available: ${freemem}GB)`);
if (!fs.existsSync(require('./config').configPath)) {
logFailed('Configuration not found');
return State.failed;
}
// Load config
const conf = require('./config').default;
logDone('Success to load configuration');
logInfo(`maintainer: ${conf.maintainer}`);
checkDependencies();
// Check if a port is being used
if (await portUsed.check(conf.port)) {
logFailed(`Port: ${conf.port} is already used!`);
return State.failed;
}
// Try to connect to MongoDB
try {
await initdb(conf);
logDone('Success to connect to MongoDB');
} catch (e) {
logFailed(`MongoDB: ${e}`);
return State.failed;
}
return warn ? State.warn : State.success;
}
开发者ID:syuilo,项目名称:misskey-core,代码行数:60,代码来源:index.ts
示例3: checkDependency
function checkDependency(serviceName: string, command: string, transform: (x: string) => string): void {
const code = {
success: 0,
notFound: 127
};
const x = exec(command, { silent: true }) as any;
if (x.code === code.success) {
logInfo(`DEPS: ${serviceName} ${transform(x.stdout)}`);
} else if (x.code === code.notFound) {
logWarn(`Unable to find ${serviceName}`);
}
}
开发者ID:syuilo,项目名称:misskey-core,代码行数:12,代码来源:check-dependencies.ts
示例4: notFoundHandler
function notFoundHandler(req: any, res: any): any {
logWarn(`Request not handled: ${req.method.toUpperCase()} ${req.path}`);
return res({
error: 'api-not-found'
}).code(404);
}
开发者ID:akionux,项目名称:Misskey-API,代码行数:6,代码来源:server.ts
注:本文中的log-cool.logWarn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论