本文整理匯總了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;
}
};