本文整理汇总了TypeScript中lib/tylogger.LogDebug函数的典型用法代码示例。如果您正苦于以下问题:TypeScript LogDebug函数的具体用法?TypeScript LogDebug怎么用?TypeScript LogDebug使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LogDebug函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: verificationMail
export function verificationMail(uid, address): Object{
try{
// Make sure the user exists, and address is one of their addresses.
var user = Meteor.users.findOne({_id: uid});
if (!user){
//throw new Error("Can't find user");
LogDebug('Cannot find user')
return null
}
// pick the first unverified address if we weren't passed an address.
if (!address) {
var email = _.find(user.emails || [],
function (e) { return !e.verified; });
address = (email || {}).address;
}
// make sure we have a valid address
if (!address || !_.contains(_.pluck(user.emails || [], 'address'), address)){
//throw new Error("No such email address for user.");
LogDebug('no email')
return null
}
var tokenRecord = {
token: RandomStr(44),
address: address,
when: new Date()
};
Meteor.users.update({_id: uid}, {$push: {'services.email.verificationTokens': tokenRecord}});
// before passing to template, update user object with new token
Meteor._ensure(user, 'services', 'email');
if (!user.services.email.verificationTokens) {
user.services.email.verificationTokens = [];
}
user.services.email.verificationTokens.push(tokenRecord);
//var verifyEmailUrl = Accounts.urls.verifyEmail(tokenRecord.token);
var mailbody = writeVerifyEmail(address, tokenRecord.token, user.username)
return mailbody;
}catch(err){
LogDB(err.toString(), 'verificationMail()', uid)
return null
}
}
示例2: changeEmail
export function changeEmail(uid, mail){
try{
if(!mail || !validateEmail(mail)){
//throw new Error("无效邮件地址.");
return "无效邮件地址!"
}
let user = Meteor.users.findOne({_id: uid})
var oldmail = _.find(user.emails || [],
function (e) { return e.address; });
let address = (oldmail || {}).address;
LogDebug(address, mail)
if(address && address == mail){
return 'mail is unchanged'
}
if(address){
Accounts.removeEmail(uid, address)
}
Accounts.addEmail(uid, mail)
return 'ok'
}catch(err){
LogDB(err.toString(), 'changeEmail()', uid)
return err.toString()
}
}
示例3: function
sendResetPasswordEmail: function(email){
try{
let user = Accounts.findUserByEmail(email)
if(!user){
return "找不到使用这个信箱的用户。"
}
let mailbody = sendResetPasswordEmail(user._id, email)
NigerianPrinceGun.send(mailbody)
LogDebug('reset password email is sended.')
return null
}catch(err){
LogDB(err.toString(), email, this.userId)
return err.toString()
}
},
示例4: verificationMail
Accounts.onCreateUser(function(options, user) {
try{
Meteor.setTimeout(function() {
let mailbody = verificationMail(user._id, null)
if(mailbody){
NigerianPrinceGun.send(mailbody)
}
UserImages.insert({user: user._id, quote: 100, current: 0, del: []})
}, 5 * 1000);
}catch(err){
LogDB(err.toString(), options, 'onCreateUser')
LogDebug(err)
}
if (options.profile){
user.profile = options.profile;
}
return user;
});
示例5: initQiniu
export function initQiniu(){
try{
// 生成实例
var qiniu = new QiniuSDK(config);
let bucket = {
'bucket': 'huaheapp',
'onUploaded': onUploaded,
'callbackBody': 'key=$(key)&bucket=$(bucket)&userId=$(x:userId)',
'insertOnly': 0
}
// 添加单个 bucket
qiniu.addBucket(bucket); // 可以获取token了,背后设置了 callbackUrl
// 应用配置
qiniu.init();
console.log('qiniu inited !')
}catch(err){
LogDB(err.toString(), 'initQiniu', 'server')
LogDebug('init qiniu error: ', err)
}
}
示例6: onUploaded
function onUploaded(res){
LogDebug("image uploaded", res)
}