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