本文整理匯總了TypeScript中@microsoft/sp-core-library.Log類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Log類的具體用法?TypeScript Log怎麽用?TypeScript Log使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Log類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: onInit
@override
public onInit(): Promise<void> {
Log.info(LOG_SOURCE, 'Activated TaskPriorityFieldCustomizer with properties:');
Log.info(LOG_SOURCE, JSON.stringify(this.properties, undefined, 2));
Log.info(LOG_SOURCE, `The following string should be equal: "TaskPriority" and "${strings.Title}"`);
return Promise.resolve<void>();
}
示例2: onInit
@override
public async onInit(): Promise<void> {
Log.info(LOG_SOURCE, `Initialized ${strings.Title}`);
// Added to handle possible changes on the existence of placeholders
// this.context.placeholderProvider.changedEvent.add(this, this._renderPlaceHolders);
// this.context.application._layoutChangedEvent.add(this, this._layoutChanged);
// Retrieve the menu items from taxonomy
Log.info(LOG_SOURCE, `Creating instance of SPTermStore.SPTermStoreService`);
Log.info(LOG_SOURCE, `spHttpClient: ${this.context.spHttpClient}`);
Log.info(LOG_SOURCE, `siteAbsoluteUrl: ${this.context.pageContext.web.absoluteUrl}`);
let termStoreService: SPTermStore.SPTermStoreService = new SPTermStore.SPTermStoreService({
spHttpClient: this.context.spHttpClient,
siteAbsoluteUrl: this.context.pageContext.web.absoluteUrl,
});
Log.info(LOG_SOURCE, `SourceTermSetName: ${this.properties.SourceTermSetName}`);
this._bottomMenuItems = await termStoreService.getTermsFromTermSetAsync(this.properties.SourceTermSetName);
// Call render method for generating the needed html elements
this._renderPlaceHolders();
return Promise.resolve<void>();
}
示例3: onInit
@override
public onInit(): Promise<void> {
Log._initialize(new LogHandler((window as any).LOG_LEVEL || LogLevel.Error));
Log.verbose(LOG_SOURCE, 'Activated ConditionalFormattingFieldCustomizer with properties:');
Log.verbose(LOG_SOURCE, JSON.stringify(this.properties, undefined, 2));
return Promise.resolve<void>();
}
示例4: onInit
@override
public onInit(): Promise<void> {
// Add your custom initialization to this method. The framework will wait
// for the returned promise to resolve before firing any BaseFieldCustomizer events.
Log.info(LOG_SOURCE, 'Activated CustomColorFieldFieldCustomizer with properties:');
Log.info(LOG_SOURCE, JSON.stringify(this.properties, undefined, 2));
Log.info(LOG_SOURCE, `The following string should be equal: "CustomColorFieldFieldCustomizer" and "${strings.Title}"`);
return Promise.resolve();
}
示例5: onInit
@override
public onInit(): Promise<void> {
Log._initialize(new ConsoleLogHandler((window as any).LOG_LEVEL || LogLevel.Error));
Log.info(LOG_SOURCE, `Initialized ${strings.Title}`);
if (!this.properties.siteUrl ||
!this.properties.listName) {
const e: Error = new Error('Missing required configuration parameters');
Log.error(LOG_SOURCE, e);
return Promise.reject(e);
}
return Promise.resolve<void>();
}
示例6: getLookupOptions
function getLookupOptions(state: Array<LookupOptions>, action) {
let newstate = _.clone(state);
newstate.push(action.payload.lookupOptions);
Log.info("getLookupOptions", "Added Header Record");
return newstate;
}
示例7: _renderPlaceHolders
private _renderPlaceHolders(): void {
Log.info(LOG_SOURCE, `Available placeholders: ${this.context.placeholderProvider.placeholderNames.map(name => PlaceholderName[name]).join(', ')}`);
// Handling the bottom placeholder
if (!this._bottomPlaceholder) {
this._bottomPlaceholder =
this.context.placeholderProvider.tryCreateContent(
PlaceholderName.Bottom,
{ onDispose: this._onDispose });
// The extension should not assume that the expected placeholder is available.
if (!this._bottomPlaceholder) {
console.error('The expected placeholder (Bottom) was not found.');
return;
}
const withinPages: boolean = this.context.pageContext.listItem != null;
if (this.properties && withinPages) {
const element: React.ReactElement<IYammerFooterBarProps> = React.createElement(
YammerFooterBar,
{
context: this.context,
sourceTermSetName: this.properties.SourceTermSetName,
menuItems: this._bottomMenuItems
}
);
ReactDom.render(element, this._bottomPlaceholder.domElement);
}
}
}
示例8: SubscribeToStatusChangeForUser
public async SubscribeToStatusChangeForUser(userEmail: string, userDisplayName: string,
handler: (newStatus: string, oldStatus: string, displayName: string) => void): Promise<boolean> {
if (!userEmail || !handler) {
return false;
}
userDisplayName = userDisplayName.replace("(...)", "");
const skypeApp: any = await this.Initialize();
const personsAndGroupsManager: any = skypeApp.personsAndGroupsManager;
const mePerson: any = personsAndGroupsManager.mePerson;
if (SkypeForBusinessCommunicationService.webPartContext().pageContext.user.email === userEmail) {
Log.info(Constants.ErrorCategory, `Bypassed skype subscription for current user ${userEmail}`);
handler("Online", undefined, mePerson.displayName());
} else {
const query: any = personsAndGroupsManager.createPersonSearchQuery();
query.text(userEmail);
query.limit(1);
await query.getMore();
query.results().forEach((result) => {
const person: any = result.result;
if (person.id().indexOf(userEmail) !== -1) {
handler("Offline", undefined, userDisplayName);
person.status.changed((newStatus, reason, oldStatus) => {
Log.info(Constants.ErrorCategory,
`${person.displayName()} status changed from ${oldStatus} to ${newStatus} because ${reason}`);
handler(newStatus, oldStatus, person.displayName());
});
person.status.subscribe();
}
});
}
return true;
}
示例9: resolve
return jQuery.getScript("https://swx.cdn.skype.com/shared/v/1.2.36/SkypeBootstrap.min.js").then(() => {
const config: {apiKey: string, apiKeyCC: string} = {
apiKey: "a42fcebd-5b43-4b89-a065-74450fb91255", // sdk
apiKeyCC: "9c967f6b-a846-4df2-b43d-5167e47d81e1", // sdk+ui
};
if (currentConfiguration && currentConfiguration.ClientId) {
Skype.initialize({ apiKey: config.apiKey }, (api) => {
const app: any = new api.application();
app.signInManager.signIn ({
client_id: currentConfiguration.ClientId,
cors: true,
origins: ["https://webdir.online.lync.com/autodiscover/autodiscoverservice.svc/root"],
redirect_uri: currentConfiguration.RedirectUri,
}).then(() => {
resolve(app);
}, (err: any) => {
Log.error(Constants.ErrorCategory, new Error(`cannot sign in ${err}`));
location.assign("https://login.microsoftonline.com/common/oauth2/authorize?response_type=token" +
"&client_id=" + currentConfiguration.ClientId +
"&redirect_uri=" + location.href +
"&resource=https://webdir.online.lync.com");
reject(err);
});
});
} else {
Log.error(Constants.ErrorCategory, new Error(`configuration missing for skype presence service`));
}
});
示例10: removeListItem
export function removeListItem(dispatch: any, listItem: ListItem, listDefinition: ListDefinition): any {
const weburl = utils.ParseSPField(listDefinition.webLookup).id;
const listid = utils.ParseSPField(listDefinition.listLookup).id;
const web = new Web(weburl);
switch (listItem.__metadata__GridRowStatus) {
case GridRowStatus.toBeDeleted:
web.lists.getById(listid).items.getById(listItem.ID).recycle()
.then((response) => {
// shouwld have an option to rfresh here in cas of calculated columns
const gotListItems = removeListItemSuccessAction(listItem);
dispatch(gotListItems); // need to ewname this one to be digfferent from the omported ome
})
.catch((error) => {
console.log(error);
dispatch(removeListItemErrorAction(error)); // need to ewname this one to be digfferent from the omported ome
});
return {
type: REMOVE_LISTITEM,
payload: {
listItem: listItem
}
};
default:
Log.warn("ListItemContainer", "Invalid GrodrowStatus in update ListiteRender-- " + listItem.__metadata__GridRowStatus.toString());
}
}