Skip to content

Logging

Logging with sp-core-library

Reference the Log class

import { Log } from "@microsoft/sp-core-library";

Log your message from your WebPart

Log.verbose("HelloWorld", "Here is a verbose log", this.context.serviceScope);
Log.info("HelloWorld", "Here is an informational message.", this.context.serviceScope);
Log.warn("HelloWorld", "Oh Oh, this might be bad", this.context.serviceScope);
Log.error("HelloWorld", new Error("Oh No!  Error!  Ahhhhhh!!!!"), this.context.serviceScope);

Logging with pnp-logging

Logging with AppInsights