当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript sp-pnp-js.Logger类代码示例

本文整理汇总了TypeScript中sp-pnp-js.Logger的典型用法代码示例。如果您正苦于以下问题:TypeScript Logger类的具体用法?TypeScript Logger怎么用?TypeScript Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Logger类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getTermById

    /**
     * Get a single term by its Id using the current taxonomy context.
     * @param  {SP.Guid} termId The taxonomy term Id
     * @return {Promise<SP.Taxonomy.Term>}       A promise containing the term infos.
     */
    public getTermById(termId: SP.Guid): Promise<SP.Taxonomy.Term> {

        if (termId) {

            const context: SP.ClientContext = SP.ClientContext.get_current();

            const taxSession: SP.Taxonomy.TaxonomySession  = SP.Taxonomy.TaxonomySession.getTaxonomySession(context);
            const termStore: SP.Taxonomy.TermStore = taxSession.getDefaultSiteCollectionTermStore();

            termStore.set_workingLanguage(this.workingLanguage);

            const term: SP.Taxonomy.Term = termStore.getTerm(termId);

            context.load(term, "Name");

            const p = new Promise<SP.Taxonomy.Term>((resolve, reject) => {

                context.executeQueryAsync(() => {

                    resolve(term);

                },  (sender, args) => {

                    reject("Request failed. " + args.get_message() + "\n" + args.get_stackTrace());
                });
            });

            return p;

        } else {
            Logger.write("[TaxonomyModule.getTermById]: the provided term id is null!", LogLevel.Error);
        }
    }
开发者ID:AKrasheninnikov,项目名称:PnP,代码行数:38,代码来源:TaxonomyModule.ts

示例2:

            }).catch((errorMesssage) => {

                this.errorMessage(errorMesssage + ". Empty the localStorage values in the browser for the configuration list and try again.");
                this.wait(false);
                this.initialize([]);
                Logger.write("[TopNav.getNavigationNodes]: " + errorMesssage, LogLevel.Error);
            });
开发者ID:OneBitSoftware,项目名称:PnP,代码行数:7,代码来源:TopNavViewModel.ts

示例3: constructor

 constructor(logLevel: LogLevel, webPartContext: IWebPartContext) {
     // setup logger
     Logger.subscribe(new ConsoleListener());
     Logger.activeLogLevel = logLevel;
     // set web part context
     this._webPartContext = webPartContext;
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例4: SearchNavigationNode

            }).then((response) => {

                if (response.ok) {

                    response.json().then((data: any) => {

                        const nodes: ISearchNavigationNode[] =  data.d.results.map((elt) => {

                            let url = elt.Url;
                            if (!Util.isUrlAbsolute(url)) {

                                // IE fix
                                let origin = window.location.origin;
                                if (!origin) {
                                    origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
                                }

                                url = Util.combinePaths(origin, url);
                            }

                            return new SearchNavigationNode(elt.Title, url);
                        });

                        resolve(nodes);
                    });

                } else {
                    Logger.write("[SearchModule.getSearchNavigationSettings()] Error: " + response.statusText, LogLevel.Error);
                    reject();
                }
            });
开发者ID:AKrasheninnikov,项目名称:PnP,代码行数:31,代码来源:SearchModule.ts

示例5: getNavigationNodes

    private getNavigationNodes(termSetId: string): void {

        if (!termSetId) {

            Logger.write("[FooterLinks.getNavigationNodes]: The term set id for the footer links is null. Please specify a valid term set id in the configuration list", LogLevel.Error);

        } else {

            // Ensure all SP dependencies are loaded before retrieving navigation nodes
            this.taxonomyModule.init().then(() => {

            // Initialize the main menu with taxonomy terms
            this.taxonomyModule.getNavigationTaxonomyNodes(new SP.Guid(termSetId)).then((navigationTree) => {

                        // Initialize the mainMenu view model
                        this.initialize(navigationTree);
                        this.wait(false);

                        const now: Date = new Date();

                        // Set the navigation tree in the local storage of the browser
                        storage.local.put(this.localStorageKey, this.utilityModule.stringifyTreeObject(navigationTree), new Date(now.setDate(now.getDate() + 7)));

                }).catch((errorMesssage) => {

                    Logger.write("[FooterLinks.getNavigationNodes]: " + errorMesssage, LogLevel.Error);
                });

            }).catch((errorMesssage) => {

                Logger.write("[FooterLinks.getNavigationNodes]: " + errorMesssage, LogLevel.Error);
            });
        }
    }
开发者ID:DI-Paulk,项目名称:PnP,代码行数:34,代码来源:FooterLinksViewModel.ts

示例6:

            web.lists.getById(_spPageContextInfo.pageListId.replace(/{|}/g, "")).items.getById(_spPageContextInfo.pageItemId).select(this.siteMapFieldName).get().then((item) => {

                    const siteMapTermGuid = item[this.siteMapFieldName];
                    let currentNode: TaxonomyNavigationNode;

                    if (siteMapTermGuid) {

                        // 1: Search for this guid in the site map
                        currentNode = this.utilityModule.getNodeByTermId(navigationTree, siteMapTermGuid.TermGuid);
                    }

                    if (currentNode === undefined) {

                        // 2: Get the navigation node according to the current URL
                        currentNode = this.utilityModule.getNodeByUrl(navigationTree, window.location.pathname);
                    }

                    if (currentNode !== undefined) {

                        // If there is no 'ParentId', this is a root term
                        if (currentNode.ParentId !== null) {

                            const parentNode = this.utilityModule.getNodeByTermId(navigationTree, currentNode.ParentId);

                            // Set the parent section
                            this.parentSection(parentNode);

                            if (parentNode.ChildNodes.length > 0) {

                                // Display all siblings and child nodes from the current node (just like the CSOM results)
                                // Siblings = children of my own parent ;)
                                navigationTree = parentNode.ChildNodes;

                                // Set the current node as first item
                                navigationTree = this.utilityModule.moveItem(navigationTree, navigationTree.indexOf(currentNode), 0);
                            }
                        }

                    } else {

                        Logger.write("[ContextualMenu.subscribe]: Unable to determine the current position in the site map", LogLevel.Warning);
                    }

                    this.initialize(navigationTree);
                    this.wait(false);

                    if (currentNode !== undefined) {

                        this.setCurrentNode(currentNode.Id);
                    }

                    // Truncate links
                    $("#contextualmenu a").trunk8({
                        lines: 3,
                        tooltip: true,
                    });

            }).catch((errorMesssage) => {
开发者ID:OneBitSoftware,项目名称:PnP,代码行数:58,代码来源:ContextualMenuViewModel.ts

示例7: deleteReply

    /**
     * Delete a reply in an existing discussion
     * @param replyId the item id to delete
     */
    public async deleteReply(replyId: number): Promise<number> {

        try {
            const web = new Web(_spPageContextInfo.webAbsoluteUrl);
            await web.getList(this.discussionListServerRelativeUrl).items.getById(replyId).delete();
            return replyId;

        } catch (error) {
            Logger.write(`[SocialModule:deleteReply]: ${error}`, LogLevel.Error);
            throw error;
        }
    }
开发者ID:ScoutmanPt,项目名称:PnP,代码行数:16,代码来源:SocialModule.ts

示例8: getNavigationNodes

    private getNavigationNodes(termSetId: string): void {

        if (!termSetId) {

            const errorMesssage = "The term set id for the site map is null. Please specify a valid term set id in the configuration list";
            Logger.write("[TopNav.getNavigationNodes]: " + errorMesssage, LogLevel.Error);

            this.errorMessage(errorMesssage);
            this.wait(false);

        } else {

            // Ensure all SP dependencies are loaded before retrieving navigation nodes
            this.taxonomyModule.init().then(() => {

            // Initialize the main menu with taxonomy terms
            this.taxonomyModule.getNavigationTaxonomyNodes(new SP.Guid(termSetId)).then((navigationTree: ITaxonomyNavigationNode[]) => {

                        // Initialize the mainMenu view model
                        this.initialize(navigationTree);
                        this.wait(false);

                        // Publish the data to all subscribers (contextual menu and breadcrumb)
                        PubSub.publish("navigationNodes", { nodes: navigationTree } );

                        const now: Date = new Date();

                        // Clear the local storage value
                        storage.local.delete(this.localStorageKey);

                        // Set the navigation tree in the local storage of the browser
                        storage.local.put(this.localStorageKey, this.utilityModule.stringifyTreeObject(navigationTree), new Date(now.setDate(now.getDate() + 7)));

                }).catch((errorMesssage) => {

                    this.errorMessage(errorMesssage + ". Empty the localStorage values in the browser for the configuration list and try again.");
                    this.wait(false);
                    this.initialize([]);
                    Logger.write("[TopNav.getNavigationNodes]: " + errorMesssage, LogLevel.Error);
                });

            }).catch((errorMesssage) => {

                this.errorMessage(errorMesssage + ". Empty the localStorage values in the browser for the configuration list and try again.");
                this.wait(false);
                this.initialize([]);
                Logger.write("[TopNav.getNavigationNodes]: " + errorMesssage, LogLevel.Error);
            });
        }
    }
开发者ID:OneBitSoftware,项目名称:PnP,代码行数:50,代码来源:TopNavViewModel.ts

示例9: resolve

                }).select(ConfigurationItem.SelectFields.toString()).getAs(spODataEntityArray(ConfigurationItem)).then((items: ConfigurationItem[]) => {

                if (items.length > 0) {

                    // Get item corresponding to the current language
                    const item: any = _.find(items, (e: ConfigurationItem) => e.IntranetContentLanguage === language);

                    if (item) {
                        resolve(item);
                    }
                } else {
                    Logger.write("[UtilityModule.getConfigurationListValuesForLanguage]: There is no configuration item for the language '" + language + "'", LogLevel.Error);
                }
            }).catch((errorMesssage) => {
开发者ID:ScoutmanPt,项目名称:PnP,代码行数:14,代码来源:UtilityModule.ts

示例10: updateReply

    /**
     * Updates a reply
     * @param replyId The reply id to update
     * @param replyBody The new reply body
     */
    public async updateReply(replyId: number, replyBody: string): Promise<void> {

        try {
            const web = new Web(_spPageContextInfo.webAbsoluteUrl);
            const result = await web.getList(this.discussionListServerRelativeUrl).items.getById(replyId).select("Modified").update({
                Body: replyBody,
            });

            return;

        } catch (error) {
            Logger.write(`[SocialModule:updateReply]: ${error}`, LogLevel.Error);
            throw error;
        }
    }
开发者ID:ScoutmanPt,项目名称:PnP,代码行数:20,代码来源:SocialModule.ts


注:本文中的sp-pnp-js.Logger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。