本文整理汇总了TypeScript中loglevel.info函数的典型用法代码示例。如果您正苦于以下问题:TypeScript info函数的具体用法?TypeScript info怎么用?TypeScript info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了info函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: if
.map(res => {
const user = res[0];
const askForAuths = res[1];
const latestVersion = res[2];
// is approval required for this authenticator
const approvalRequired = askForAuths.indexOf(user.auth) !== -1;
// has user already approved the terms of use
const approved =
user.termsVersion >= latestVersion && user.termsAccepted != null;
if (!approvalRequired) {
return true;
} else if (approved) {
log.info("terms of use accepted already");
return true;
} else {
log.info(
"terms of use must be accepted first",
", required for this auth:",
approvalRequired,
", accpeted version:",
user.termVersion,
", latest version:",
latestVersion,
", accepted timestamp:",
user.termsAccepted
);
this.routeService.navigateAbsolute("/terms");
return false;
}
})
示例2:
.flatMap(session => {
log.info("session copied, current state", session.state, temporary);
if (temporary) {
session.state = SessionState.TemporaryUnmodified;
} else {
session.state = SessionState.Ready;
}
log.info("set to", session.state);
return this.updateSession(session);
})
示例3:
path => {
if (path) {
this.homeFile = this.routeService.basename(path);
this.homePath = this.routeService.dirname(path) + "/";
log.info("loading custom home page", this.homePath, this.homeFile);
}
},
示例4: onBuild
// error handling taken from https://webpack.github.io/docs/node.js-api.html#error-handling
function onBuild(
resolve: any,
reject: any,
err: any,
stats: compiler.Stats,
watcher?: any
) {
if (err) {
// "hard" error
return reject(err);
}
if (stats.hasErrors()) {
// "soft" error
return reject(stringifyStats(stats));
}
if (stats.hasWarnings()) {
warn(stringifyStats(stats));
}
if (isVerbose()) {
info(stringifyStats(stats));
}
// note: watcher is optional
resolve(watcher);
}
示例5: watch
export default async function watch() {
await removeAsync(project.ws.distDir);
const port = await findAsync({
startingPort: 35729
});
const livereloadServer = livereload.createServer({ port });
const onChangeSuccess = (stats) => info(`Finished build at ${cyan(moment(stats.endTime).format('HH:mm:ss'))}.`);
switch (project.ws.type) {
case TYPE.NODE:
await watchAsync(livereloadServer, nodeOptions, onChangeSuccess);
break;
case TYPE.SPA:
if (project.ws.i18n) {
await watchAsync(livereloadServer, createLocaleSpecificOptions(spaOptions, project.ws.i18n.locales[0]), onChangeSuccess);
} else {
await watchAsync(livereloadServer, spaOptions, onChangeSuccess);
}
break;
case TYPE.BROWSER:
if (project.ws.i18n) {
await watchAsync(livereloadServer, createLocaleSpecificOptions(browserOptions, project.ws.i18n.locales[0]), onChangeSuccess);
} else {
await watchAsync(livereloadServer, browserOptions, onChangeSuccess);
}
break;
}
info('Finished initial build.');
const middlewares = [
livereloadMiddleware()
];
await listenAsync(middlewares);
};
示例6:
(latestSession: LatestSession) => {
// valid id from store?
const idFromStore = latestSession.sessionId;
if (
idFromStore &&
sessions.some(session => session.sessionId === idFromStore)
) {
log.info("found valid latest session id from store", idFromStore);
return Observable.of(idFromStore);
} else {
// valid source session id from store?
const sourceSessionIdFromStore = latestSession.sourceSessionId;
if (
sourceSessionIdFromStore &&
sessions.some(
session => session.sessionId === sourceSessionIdFromStore
)
) {
log.info(
"found valid source session id from store",
sourceSessionIdFromStore
);
return Observable.of(sourceSessionIdFromStore);
} else {
// valid id from session db?
return this.getLatestSessionFromSessionDb().mergeMap(
(idFromSessionDb: string) => {
if (
idFromSessionDb !== null &&
sessions.some(
session => session.sessionId === idFromSessionDb
)
) {
log.info(
"found valid latest session id from sessionDb",
idFromSessionDb
);
return Observable.of(idFromSessionDb);
} else {
log.info("no valid latest session id in sessionDb");
return Observable.of(null);
}
}
);
}
}
}
示例7:
() => {
log.info("websocket closed");
// if not unsubscribed
if (this.topic) {
// reconnect after clean close (server idle timeout)
this.connect(listener, topic);
}
}
示例8: return
return (options) => {
// handle global options
setLevel(levels[options.parent.logLevel.toUpperCase()]);
// handle specific action
info(`run ${cyan(options.name())}...`);
return action(options)
.then(() => info(`finished ${cyan(options.name())} ♥`))
.catch(handleError);
};
示例9: build
export default async function build(options) {
switch (project.ws.type) {
case TYPE.NODE:
await removeAsync(project.ws.distDir);
await compileAsync(nodeOptions);
break;
case TYPE.SPA:
if (options.production) {
await removeAsync(project.ws.distReleaseDir);
if (project.ws.i18n) {
for (const locale of project.ws.i18n.locales) {
info(`...for locale ${locale}.`);
await compileAsync(createLocaleSpecificOptions(spaReleaseOptions, locale));
}
} else {
await compileAsync(spaReleaseOptions);
}
} else {
await removeAsync(project.ws.distDir);
if (project.ws.i18n) {
await compileAsync(createLocaleSpecificOptions(spaOptions, project.ws.i18n.locales[0]));
} else {
await compileAsync(spaOptions);
}
}
break;
case TYPE.BROWSER:
await removeAsync(project.ws.distDir);
if (project.ws.i18n) {
for (const locale of project.ws.i18n.locales) {
info(`...for locale ${locale}.`);
await compileAsync(createLocaleSpecificOptions(browserOptions, locale));
await compileAsync(createLocaleSpecificOptions(browserReleaseOptions, locale));
}
info(`...with all locales.`);
}
// even when we use locales, we create a default build containing *all* translations
// users can select a locale with `window.process = { env: { LOCALE: 'en_GB' } };`, before they load
// our component (this is mostly for users without build tools)
await compileAsync(browserOptions);
await compileAsync(browserReleaseOptions);
break;
}
};