diff --git a/README.md b/README.md index 668bc81..20da031 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@

A simple project to easily add a log to your projects
- Releases - - Report Bug + Releases - + Report Bug

@@ -26,11 +26,11 @@ This project was to just offer people a easy way to quickly add the ability to o ### Class Version -The class Version is the preffered version however this version is limited to PowerShell Version 5.0 and greater and utilises the *Using* statement. +The class Version is the preferred version however this version is limited to PowerShell Version 5.0 and greater and utilizes the *Using* statement. ### Module Version -The Module Version is available for those prefering to use *Import-Module* and those using older versions of PowerShell as the Class version will not work on PowerShell versions prior to 5.0. +The Module Version is available for those preferring to use *Import-Module* and those using older versions of PowerShell as the Class version will not work on PowerShell versions prior to 5.0.

(back to top)

@@ -43,36 +43,42 @@ To get a local copy up and running follow these simple example steps. ### Prerequisites This is an example of how to list things you need to use the software and how to install them. + * PowerShell version 2.0 or greater - Module Version. * PowerShell version 5.0 or greater - Either version. ### Installation of Class Version -1. Download the latest release. +1. Download the latest release. 2. Extract the zipped folder. 3. Place the "Write-Log" folder in your project's folder or in a location the script can access under the context it will be ran. -4. Add the Using satement pointing to the Write-Log-Class.psm1 file, please note using statements must be the very first lines of your script. In this example the Write-Log folder containing the file is in the root folder with the script calling it. +4. Add the Using statement pointing to the Write-Log-Class.psm1 file, please note using statements must be the very first lines of your script. In this example the Write-Log folder containing the file is in the root folder with the script calling it. + ```ps1 using module ".\Write-Log\Write-Log-Class.psm1" ``` -4. See Class Version Usage section for examples on how to configure the log location and add enteries. + +1. See Class Version Usage section for examples on how to configure the log location and add entries. ### Installation of Module Version -1. Download the latest release. +1. Download the latest release. 2. Extra the zipped folder. 3. Ensure the Write-log.psm1 remains in a folder called "Write-Log" and place the Write-Log folder in your project's folder or in a location the script can access under the context it will be ran. -4. Import the Module. In this example the Write-Log folder is in the root of the project folder. +4. Import the Module. In this example the Write-Log folder is in the root of the project folder. + ```ps1 -$module = "$psscriptroot\Write-Log" +$module = "$PSScriptRoot\Write-Log" if(!(test-path $module)){ write-host "$module not found" -ForegroundColor Red exit } Import-Module $module ``` -4. See Module Version Usage section for examples on how to configure the log location and add enteries. -5. Add the Remove-Module line to the bottom of your script. + +1. See Module Version Usage section for examples on how to configure the log location and add entries. +2. Add the Remove-Module line to the bottom of your script. + ```ps1 Remove-Module Write-Log ``` @@ -81,17 +87,19 @@ Remove-Module Write-Log ## Usage of the Class Version + ```ps1 using module ".\Class\Write-Log\Write-Log-Class.psm1" $Log = [WriteLog]::New("C:\Example\mylog.log") -$Log.AddInfo("Something occured that was wroth making an info log about") +$Log.AddInfo("Something occurred that was worth making an info log about") $Log.AddError("There was a huge error!") -$Log.AddWarning("Oh dear I should really warn you about this!") +$Log.AddWarning("Oh dear, I should really warn you about this!") $Log.AddEntry("Testing","Test Severity") #This method is hidden but can be used for custom severities ``` -The below example shows having mutliple Write-Log objects to store different types or log enteries in different logs. + +The below example shows having multiple Write-Log objects to store different types or log entries in different logs. ```ps1 using module ".\Class\Write-Log\Write-Log-Class.psm1" @@ -100,14 +108,15 @@ $InfoLog = [WriteLog]::New("C:\Example\Info.log") $ErrorLog = [WriteLog]::New("C:\Example\Errors.log") $WarningLog = [WriteLog]::New("C:\Example\Warning.log") -$InfoLog.AddInfo("Something occured that was wroth making an info log about") +$InfoLog.AddInfo("Something occurred that was worth making an info log about") $ErrorLog.AddError("There was a huge error!") -$WarningLog.AddWarning("Oh dear I should really warn you about this!") +$WarningLog.AddWarning("Oh dear, I should really warn you about this!") ``` ## Usage of the Module version + ```ps1 -$module = "$psscriptroot\Module\Write-Log" +$module = "$PSScriptRoot\Module\Write-Log" if(!(test-path $module)){ write-host "$module not found" -ForegroundColor Red exit @@ -122,9 +131,11 @@ write-log "This is an example Warning" -severity "Warning" -logLocation $logLoca Remove-Module Write-Log ``` -Below is an example of having seperate logs for Info, Error and Warning enteries. + +Below is an example of having separate logs for Info, Error and Warning entries. + ```ps1 -$module = "$psscriptroot\Module\Write-Log" +$module = "$PSScriptRoot\Module\Write-Log" if(!(test-path $module)){ write-host "$module not found" -ForegroundColor Red exit @@ -141,6 +152,7 @@ write-log "This is an example Warning" -severity "Warning" -logLocation $Warning Remove-Module Write-Log ``` +

(back to top)

@@ -168,13 +180,13 @@ Don't forget to give the project a star! Thanks again! -[contributors-shield]: https://img.shields.io/github/contributors/captainqwerty/Write-Log.svg?style=for-the-badge -[contributors-url]: https://github.com/captainqwerty/Write-Log/graphs/contributors -[forks-shield]: https://img.shields.io/github/forks/captainqwerty/Write-Log.svg?style=for-the-badge -[forks-url]: https://github.com/captainqwerty/Write-Log/network/members -[stars-shield]: https://img.shields.io/github/stars/captainqwerty/Write-Log.svg?style=for-the-badge -[stars-url]: https://github.com/captainqwerty/Write-Log/stargazers -[issues-shield]: https://img.shields.io/github/issues/captainqwerty/Write-Log.svg?style=for-the-badge -[issues-url]: https://github.com/captainqwerty/Write-Log/issues +[contributors-shield]: https://img.shields.io/github/contributors/PowershellGroup/Write-Log-Module.svg?style=for-the-badge +[contributors-url]: https://github.com/PowershellGroup/Write-Log-Module/graphs/contributors +[forks-shield]: https://img.shields.io/github/forks/PowershellGroup/Write-Log-Module.svg?style=for-the-badge +[forks-url]: https://github.com/PowershellGroup/Write-Log-Module/network/members +[stars-shield]: https://img.shields.io/github/stars/PowershellGroup/Write-Log-Module.svg?style=for-the-badge +[stars-url]: https://github.com/PowershellGroup/Write-Log-Module/stargazers +[issues-shield]: https://img.shields.io/github/issues/PowershellGroup/Write-Log-Module.svg?style=for-the-badge +[issues-url]: https://github.com/PowershellGroup/Write-Log-Module/issues [linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555 [linkedin-url]: https://www.linkedin.com/in/antonybragg/ \ No newline at end of file