https://github.com/captainqwerty/pslogwriter
PowerShell module to allow easy creation of logs within your PowerShell projects
https://github.com/captainqwerty/pslogwriter
log logging powershell
Last synced: 11 months ago
JSON representation
PowerShell module to allow easy creation of logs within your PowerShell projects
- Host: GitHub
- URL: https://github.com/captainqwerty/pslogwriter
- Owner: captainqwerty
- License: mit
- Created: 2024-10-27T17:49:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-28T23:46:22.000Z (over 1 year ago)
- Last Synced: 2025-02-08T17:41:37.662Z (about 1 year ago)
- Topics: log, logging, powershell
- Language: PowerShell
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![LinkedIn][linkedin-shield]][linkedin-url]
PSLogWriter
A simple project to easily add a log to your scripts
Releases -
Report Bug -
Change Log
## About The Project
This project was to just offer people a easy way to quickly add the ability to output a nice, simple log within their own projects. The module can output a log file of a .txt or .log format and utilises three log entry types: Information, Warning and Error.
### Features
* Information, warning and error logging
* Customisable date format
## Getting Started
### Prerequisites
* PowerShell version 5.0 or greater
### Installation
## Manual Installation
1. Download the `Source.zip` from the latest release
2. Extract the zipped folder
3. Locate your user module path:
```PowerShell
# This command will list the usable folders
$env:PSModulePath -split ';'
```
4. Copy the `PSLogWriter` folder from within the extracted folder, to your preferred module folder
5. Verify the installation
## Verification
```PowerShell
# Import the module
Import-Module PSLogWriter
# Check the module version
Get-Module PSLogWriter
# View available commands
Get-Command -Module PSLogWriter
```
## Usage
```PowerShell
# Importing the module
Import-Module PSLogWriter
# Creating a log object, you could delcare several different variable
# names to have multiple logs running for different information
$Log = New-Log -LogLocation "$PSScriptLog\Log.log"
# Examples of adding log entries
$Log.AddInfo("This message is informational") # Info entry
$Log.AddError("Oh no. Something went wrong!") # Error entry
$Log.AddWarning("Calm yourself, this is a warning") # Warning entry
$Log.AddCustomEntry("BACON","This is a bacon alert!") # Custom entry
$Log.AddCustomEntry("Bacon","Green","This is a bacon alert!") # Custom entry with custom colour
# Removing the module
Remove-Module PSLogWriter
```
## Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## Acknowledgments
* [Othneildrew's Best-README-Template](https://github.com/othneildrew/Best-README-Template)
[contributors-shield]: https://img.shields.io/github/contributors/captainqwerty/PSLogWriter.svg?style=for-the-badge
[contributors-url]: https://github.com/captainqwerty/PSLogWriter/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/captainqwerty/PSLogWriter.svg?style=for-the-badge
[forks-url]: https://github.com/captainqwerty/PSLogWriter/network/members
[stars-shield]: https://img.shields.io/github/stars/captainqwerty/PSLogWriter.svg?style=for-the-badge
[stars-url]: https://github.com/captainqwerty/PSLogWriter/stargazers
[issues-shield]: https://img.shields.io/github/issues/captainqwerty/PSLogWriter.svg?style=for-the-badge
[issues-url]: https://github.com/captainqwerty/PSLogWriter/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/