-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6745d9a
commit 50fe5e6
Showing
11 changed files
with
310 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- | ||
Module Name: PnP.PowerShell | ||
title: Set-PnPTraceLog | ||
schema: 2.0.0 | ||
applicable: SharePoint Online | ||
external help file: PnP.PowerShell.dll-Help.xml | ||
online version: https://pnp.github.io/powershell/cmdlets/Set-PnPTraceLog.html | ||
--- | ||
|
||
# Start-PnPTraceLog | ||
|
||
## SYNOPSIS | ||
Starts log tracing | ||
|
||
## SYNTAX | ||
|
||
```powershell | ||
Start-PnPTraceLog [-Path <String>] [-Level <LogLevel>] [-AutoFlush <Boolean>] | ||
``` | ||
|
||
|
||
## DESCRIPTION | ||
Starts .NET tracelogging. Many cmdlets output detailed trace information when executed. Turn on the trace log with this cmdlet, optionally specify the level. By default the level is set to 'Information', but you will receive more detail by setting the level to 'Debug'. | ||
|
||
## EXAMPLES | ||
|
||
### EXAMPLE 1 | ||
```powershell | ||
Set-PnPTraceLog -Path ./TraceOutput.txt | ||
``` | ||
|
||
This turns on trace logging to the file 'TraceOutput.txt' and will capture events of at least 'Information' level. | ||
|
||
### EXAMPLE 2 | ||
```powershell | ||
Set-PnPTraceLog -Path ./TraceOutput.txt -Level Debug | ||
``` | ||
|
||
This turns on trace logging to the file 'TraceOutput.txt' and will capture debug events. | ||
|
||
## PARAMETERS | ||
|
||
### -AutoFlush | ||
Auto flush the trace log. Defaults to true. | ||
|
||
```yaml | ||
Type: Boolean | ||
Parameter Sets: On | ||
|
||
Required: False | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
### -Level | ||
The level of events to capture. Possible values are 'Debug', 'Error', 'Warning', 'Information'. Defaults to 'Information'. | ||
```yaml | ||
Type: LogLevel | ||
Parameter Sets: On | ||
Accepted values: Debug, Error, Warning, Information | ||
|
||
Required: False | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
### -Path | ||
The path and filename of the file to write the trace log to. | ||
```yaml | ||
Type: String | ||
Parameter Sets: On | ||
|
||
Required: False | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
## RELATED LINKS | ||
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
Module Name: PnP.PowerShell | ||
title: Set-PnPTraceLog | ||
schema: 2.0.0 | ||
applicable: SharePoint Online | ||
external help file: PnP.PowerShell.dll-Help.xml | ||
online version: https://pnp.github.io/powershell/cmdlets/Set-PnPTraceLog.html | ||
--- | ||
|
||
# Stops-PnPTraceLog | ||
|
||
## SYNOPSIS | ||
Stops log tracing and flushes the log buffer if any items in there. | ||
|
||
## SYNTAX | ||
|
||
```powershell | ||
Stop-PnPTraceLog | ||
``` | ||
|
||
|
||
## DESCRIPTION | ||
Stops .NET tracelogging. Many cmdlets output detailed trace information when executed. Turn on the trace log with Start-PnPTraceLog, optionally specify the level. By default the level is set to 'Information', but you will receive more detail by setting the level to 'Debug'. | ||
|
||
## EXAMPLES | ||
|
||
### EXAMPLE 1 | ||
```powershell | ||
Stop-PnPTraceLog | ||
``` | ||
|
||
This turns off trace logging | ||
|
||
## RELATED LINKS | ||
|
||
[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
using System; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Management.Automation; | ||
using Microsoft.PowerShell.Cmdletization.Xml; | ||
using PnP.PowerShell.Model; | ||
|
||
namespace PnP.PowerShell.Commands.Base | ||
{ | ||
[Cmdlet(VerbsCommon.Get, "PnPTraceLog")] | ||
public class GetTraceLog : PSCmdlet | ||
{ | ||
[Parameter(Mandatory = false, Position = 0, ValueFromPipeline = true, ParameterSetName = "On")] | ||
public string Path; | ||
|
||
protected override void ProcessRecord() | ||
{ | ||
if (!System.IO.Path.IsPathRooted(Path)) | ||
{ | ||
Path = System.IO.Path.Combine(SessionState.Path.CurrentFileSystemLocation.Path, Path); | ||
} | ||
if (File.Exists(Path)) | ||
{ | ||
var lines = System.IO.File.ReadAllLines(Path); | ||
foreach (var line in lines) | ||
{ | ||
var items = line.Split('\t'); | ||
WriteObject(new TraceLogEntry(items), true); | ||
} | ||
} else { | ||
throw new PSArgumentException($"File {Path} does not exist"); | ||
} | ||
} | ||
|
||
|
||
} | ||
} |
Oops, something went wrong.