Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/memona008/modulerepository
Custom SPFx Logger Package helps you storing logs in Sharepoint list.
https://github.com/memona008/modulerepository
Last synced: about 1 month ago
JSON representation
Custom SPFx Logger Package helps you storing logs in Sharepoint list.
- Host: GitHub
- URL: https://github.com/memona008/modulerepository
- Owner: memona008
- Created: 2019-09-12T09:42:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-23T11:31:36.000Z (over 5 years ago)
- Last Synced: 2024-11-16T04:25:18.697Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 53.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# spfx_logger
spfx_logger is a library which is used to log into your sharepoint through code.
## Installation
Use npm to install this package
```bash
npm install spfx_logger
```## Usage
```node
import LoggerHelper from 'spfx_logger';let _logger = new LoggerHelper();
_logger.Initalize("custom_log_list");
/* Note: If list with said name doesn't exist Initilize() method will
create a new list in SharePoint for Logs
*/// After logger initialization you can Log anything in your sharepoint list
let obj:ILogger = {};
obj = {
ErrorMessage: "It is error message",
ErrorDetails: "These are error details",
Extype: "Error",
PageURL: "https:\\contoso.sharepoint.com\test\Pages\Get.aspx",
FileName: "ListService.ts",
Method: "GetItems()",
UserId: 1,
JSON: '{"error":"it is exception","message":"it is error message"}',
ProgrammeID: 1,
StatusCode: 404
}_logger.Log(obj);
// this method will log your error in the initialized List
```## Interface
```node
/* The interface which is used to store the Log Object is ILogger
Note: All columns are optional
*/
interface ILogger {
PageURL?: string;
FileName?: string;
Method?: string;
UserId?: any;
Extype?: any;
ErrorMessage?: string;
ErrorDetails?: string;
JSON?: string;
ProgrammeID?: number;
StatusCode?: number;
}
```