Create Log File in Powershell

前端 未结 8 2135
半阙折子戏
半阙折子戏 2020-11-30 22:11

I have the below code and currently it loads all the information on screen. I want it to log to a log file on D:\\Apps\\Logs.

The log file needs to have the name of

8条回答
  •  心在旅途
    2020-11-30 23:01

    Gist with log rotation: https://gist.github.com/barsv/85c93b599a763206f47aec150fb41ca0

    Usage:

    . .\logger.ps1
    Write-Log "debug message"
    Write-Log "info message" "INFO"
    

提交回复
热议问题