Friday, 31 July 2020
Wednesday, 22 July 2020
Monday, 13 July 2020
SharePoint Framework - Logging
The logging levels are pre-defined.
import ILogHandler from '@microsoft/sp-core-library/lib/log/ILogHandler';
import { ServiceScope } from '@microsoft/sp-core-library';
export enum LogLevel {
Verbose = 1,
Info,
Warning,
Error
}
import { Log } from '@microsoft/sp-core-library';
Define our log source.
const LOG_SOURCE: string = 'SPFxLogger';
Log the messages from web part.
@override
public onInit(): Promise<void> {
Log.info(LOG_SOURCE, 'Hello world from SPFx Logger');
Log.info(LOG_SOURCE, JSON.stringify(this.properties, undefined, 2));
Log.info(LOG_SOURCE, `Access the strings as "${strings.BasicGroupName}"`);
return Promise.resolve<void>();
}
https://www.c-sharpcorner.com/article/sharepoint-framework-logging/#:~:text=SharePoint%20Framework%20(SPFx)%20also%20has,lifecycle%20of%20the%20web%20part.&text=The%20logging%20levels%20are%20pre%2Ddefined.&text=Corresponds%20to%20lengthy%20events.,Logs%20almost%20everything.
Logging Level | Definition |
Verbose | Corresponds to lengthy events. Logs almost everything. |
Information | Does not require any attention. However, they provide valuable data for monitoring the state of solution. |
Warning | Indicates potential problem or issue that might need attention. We should monitor the pattern over time. If ignored, warning may result in sever error. |
Error | Requires urgent attention. All error events should be investigated. |
Critical | Indicates serious error that has caused major failure in the solution |
None | No logging occurs |
import ILogHandler from '@microsoft/sp-core-library/lib/log/ILogHandler';
import { ServiceScope } from '@microsoft/sp-core-library';
export enum LogLevel {
Verbose = 1,
Info,
Warning,
Error
}
import { Log } from '@microsoft/sp-core-library';
Define our log source.
const LOG_SOURCE: string = 'SPFxLogger';
Log the messages from web part.
@override
public onInit(): Promise<void> {
Log.info(LOG_SOURCE, 'Hello world from SPFx Logger');
Log.info(LOG_SOURCE, JSON.stringify(this.properties, undefined, 2));
Log.info(LOG_SOURCE, `Access the strings as "${strings.BasicGroupName}"`);
return Promise.resolve<void>();
}
https://www.c-sharpcorner.com/article/sharepoint-framework-logging/#:~:text=SharePoint%20Framework%20(SPFx)%20also%20has,lifecycle%20of%20the%20web%20part.&text=The%20logging%20levels%20are%20pre%2Ddefined.&text=Corresponds%20to%20lengthy%20events.,Logs%20almost%20everything.
Subscribe to:
Posts (Atom)