Skip to content

Commit

Permalink
Initial cmdlet functions
Browse files Browse the repository at this point in the history
  • Loading branch information
merddyin committed Nov 6, 2024
1 parent b266579 commit 866fe3e
Show file tree
Hide file tree
Showing 21 changed files with 5,190 additions and 6 deletions.
13 changes: 11 additions & 2 deletions plugins/nlog/Load.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
Import-Module (Join-Path $MyModulePath 'plugins\nlog\nlogmodule\0.0.2\nlogmodule.psd1') -Force -Scope:Global
Register-NLog -FileName (Join-Path $ENV:TEMP 'NetConMonitor.log') -LoggerName 'NetConMonitor'
Import-Module (Join-Path $MyModulePath 'plugins\nlog\PSNLog\0.2.5\PSNLog.psd1') -Force -Scope:Global
$LogParams = @{
Name = 'NetConMonitor'
FileName = (Join-Path $ENV:TEMP 'NetConMonitor.log')
ArchiveFileName = (Join-Path $ENV:TEMP 'NetConMonitor.{#}.log')
ArchiveNumbering = 'DateAndSequence'
ArchiveEvery = 'Day'
MaxArchiveFiles = 7
}
New-NLogFileTarget @LogParams
Enable-NLogLogging -target 'NetConMonitor' -minLevel 'Info'
58 changes: 58 additions & 0 deletions plugins/nlog/PSNLog/0.2.5/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# PSNLog Module Release History

## [0.2.5] - 2018-03-22

[Full Changelog](https://github.com/MaikKoster/PSNLog/compare/v0.2.4...v0.2.5)

### Changed

- Updated the behaviour of Enable-NLogLogging, so that it requires as minimal information as possible to get started with logging.
- Enable-NLogLogging will now redirect all calls to Write-Verbose, Write-Host, Write-Warning and Write-Error on default. One has to explicitly disable this functionality

### Fixed

- Fixed the module initialization code before built.

## [0.2.4] - 2018-03-21

[Full Changelog](https://github.com/MaikKoster/PSNLog/compare/v0.2.3...v0.2.4)

### Added

- Added CmdLet New-NLogFileTarget, as writing log messages to files is a very common task. Having a dedicated CmdLet makes it easier.

### Fixed

- Fixed build process to properly handle code that needs to be executed to properly initialize the module.
- Fixed a few typos.

## [0.2.3] - 2018-03-21

[Full Changelog](https://github.com/MaikKoster/PSNlog/compare/v0.2.2...v0.2.3)

### Added

- Added tests for the module.

### Changed

- Updated the ReadMe with details on how to make use of the cmtrace Layout Renderer

### Fixed

- Fixed typo in the Write-NlogVerbose, Write-NLogHost, Write-NLogWarning, and Write-NLogError, which prevented them to properly foward the original message.
- Fixed the New-NLogTarget CmdLet to properly use the supplied name.

## [0.2.2] - 2018-03-21

Initial public release, supporting the following actions:

- Reference NLog.dll
- Create Logger
- Create Rules
- Create Target
- Read and apply config file
- Support SimpleConfiguration
- Redirect existing Write-Verbose, Write-Warning, Write-Error calls


29 changes: 29 additions & 0 deletions plugins/nlog/PSNLog/0.2.5/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2018, Maik Koster
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Binary file added plugins/nlog/PSNLog/0.2.5/NLog.dll
Binary file not shown.
Binary file added plugins/nlog/PSNLog/0.2.5/PSGetModuleInfo.xml
Binary file not shown.
116 changes: 116 additions & 0 deletions plugins/nlog/PSNLog/0.2.5/PSNLog.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#
# Module manifest for module 'PSNLog'
#
# Generated by: Maik Koster
#
# Generated on: 3/22/2018
#

@{

# Script module or binary module file associated with this manifest.
RootModule = 'PSNLog.psm1'

# Version number of this module.
ModuleVersion = '0.2.5'

# Supported PSEditions
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = 'fe52b5c2-b2f8-4804-87c6-8606410b8f7d'

# Author of this module
Author = 'Maik Koster'

# Company or vendor of this module
CompanyName = 'Unknown'

# Copyright statement for this module
Copyright = '(c) 2018 Maik Koster. All rights reserved.'

# Description of the functionality provided by this module
Description = 'Wrapper for NLog to easily use NLog logging capabilities in PowerShell.'

# Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '3.0'

# Name of the Windows PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the Windows PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
DotNetFrameworkVersion = '4.5'

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# CLRVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
# RequiredModules = @()

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = 'NLog.dll'

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Disable-NLogLogging', 'Enable-NLogLogging', 'Get-NLogConfiguration',
'Get-NLogLogger', 'New-NLogFileTarget', 'New-NLogRule',
'New-NLogTarget', 'Read-NLogConfiguration', 'Set-NLogConfiguration',
'Test-NLogLogging', 'Write-NLogError', 'Write-NLogHost',
'Write-NLogVerbose', 'Write-NLogWarning'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()

# Variables to export from this module
VariablesToExport = @()

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = @()

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{
PSData = @{
LicenseUri = 'https://github.com/MaikKoster/PSNLog/blob/master/LICENSE'
Tags = @(
'PowerShell',
'Logging',
'NLog'
)
ProjectUri = 'https://github.com/MaikKoster/PSNLog'
}
}

# HelpInfo URI of this module
HelpInfoURI = 'http://github.com/MaikKoster/PSNLog/blob/master/PSNLog/en-US/'

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}

Loading

0 comments on commit 866fe3e

Please sign in to comment.