本文整理汇总了TypeScript中libs/slog.slog.stepIn方法的典型用法代码示例。如果您正苦于以下问题:TypeScript slog.stepIn方法的具体用法?TypeScript slog.stepIn怎么用?TypeScript slog.stepIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libs/slog.slog
的用法示例。
在下文中一共展示了slog.stepIn方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: insert
insert(obj : object)
{
const log = slog.stepIn('Collection', 'insert');
log.d(`${this.name}:${JSON.stringify(obj, null, 2)}`);
log.stepOut();
return this.collection.insert(obj);
}
示例2: onGetUser
export async function onGetUser(req : express.Request, res : express.Response)
{
const log = slog.stepIn('UserApi', 'onGetUser');
try
{
do
{
const locale = req.ext.locale;
const param : Request.GetUser = req.query;
const condition : Request.GetUser =
{
id: ['any', null, true] as any
};
if (Utils.existsParameters(param, condition) === false)
{
res.ext.badRequest(locale);
break;
}
const data = await getUser(param, req);
res.json(data);
}
while (false);
log.stepOut();
}
catch (err) {Utils.internalServerError(err, res, log);}
}
示例3: listen
/**
* listen
*/
function listen(app : express.Express) : void
{
const log = slog.stepIn('app.ts', 'listen');
const appPort = process.env.APP_PORT || Config.APP_PORT;
let server = null;
if (Config.hasSSL())
{
const options : https.ServerOptions =
{
key: null,
cert: null,
ca: null,
passphrase: Config.SSL_PASSPHRASE,
requestCert: true,
rejectUnauthorized: false
};
try
{
options.key = fs.readFileSync(Config.SSL_KEY);
options.cert = fs.readFileSync(Config.SSL_CERT);
options.ca = fs.readFileSync(Config.SSL_CA);
}
catch (err)
{
const message = `${err.path}を開けませんでした。`;
log.w(message);
console.error(message);
}
try
{
server = https.createServer(options, app).listen(appPort);
}
catch (err)
{
log.w(err.stack);
console.error(err.stack);
}
}
else
{
server = app.listen(appPort);
}
console.log('URL ........ ' + Utils.generateUrl(''));
if (server === null)
{
setTimeout(() => process.exit(), 3000);
}
else
{
SocketManager.listen(server);
}
log.stepOut();
}
示例4: destroy
SessionStore.prototype.destroy = function destroy(_sessionId, callback)
{
const log = slog.stepIn('SessionStore', 'destroy');
if (callback) {
callback(null);
}
log.stepOut();
};
示例5: clear
SessionStore.prototype.clear = function clear(callback)
{
const log = slog.stepIn('SessionStore', 'clear');
if (callback) {
callback(null);
}
log.stepOut();
};
示例6: all
SessionStore.prototype.all = function all(callback)
{
const log = slog.stepIn('SessionStore', 'all');
if (callback) {
callback(null, {});
}
log.stepOut();
};
示例7: length
SessionStore.prototype.length = function length(callback)
{
const log = slog.stepIn('SessionStore', 'length');
if (callback) {
callback(null, 0);
}
log.stepOut();
};
示例8: get
SessionStore.prototype.get = function get(_sessionId, callback)
{
const log = slog.stepIn('SessionStore', 'get');
if (callback) {
callback(null, this.session);
}
log.stepOut();
};
示例9: onLoginEmail
export async function onLoginEmail(req : express.Request, res : express.Response)
{
const log = slog.stepIn('LoginApi', 'onLoginEmail');
try
{
do
{
const locale = req.ext.locale;
const param : Request.LoginEmail = req.body;
const condition : Request.LoginEmail =
{
email: ['string', null, true] as any,
password: ['string', null, true] as any
};
if (Utils.existsParameters(param, condition) === false)
{
res.ext.badRequest(locale);
break;
}
const {email, password} = param;
const account = await AccountAgent.findByProviderId('email', email);
let hashPassword : string;
if (account) {
hashPassword = Utils.getHashPassword(email, password, Config.PASSWORD_SALT);
}
if (account === null || account.password !== hashPassword || account.signup_id)
{
const response : Response.LoginEmail =
{
status: Response.Status.FAILED,
message: {general:R.text(R.INVALID_EMAIL_AUTH, locale)}
};
log.w(JSON.stringify(response, null, 2));
res.json(response);
break;
}
process.nextTick(() =>
{
Email.verify(email, hashPassword, (_err, user) =>
{
req.ext.command = 'login';
req.user = user;
Email.callback(req, res);
});
});
}
while (false);
log.stepOut();
}
catch (err) {Utils.internalServerError(err, res, log);}
}
示例10:
test.serial('パスワード検証 - 英数以外の時は失敗すること', (t) =>
{
const log = slog.stepIn('test', t['_test'].title);
const password = 'あいうえおかきくけこ';
const result = Validator.password({password}, locale);
const {status} = result;
log.d(JSON.stringify(result, null, 2));
t.is(status, Response.Status.FAILED);
log.stepOut();
});