Skip to content

Commit

Permalink
feat: logging in windows environment (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
SMoraisAnsys committed Apr 8, 2024
1 parent 26bd332 commit f60ce81
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions _logging/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,42 @@ runs:
using: "composite"
steps:

# -------------------------------- Linux ---------------------------------

- name: "Report error message"
shell: bash
if: ${{ inputs.level == 'ERROR' }}
if: ${{ inputs.level == 'ERROR' && runner.os == 'Linux' }}
run: |
echo -e "\033[1;91m[ERROR]: ${{ inputs.message }}\033[0m"
- name: "Report warning message"
shell: bash
if: ${{ inputs.level == 'WARNING' }}
if: ${{ inputs.level == 'WARNING' && runner.os == 'Linux' }}
run: |
echo -e "\033[1;93m[WARNING]: ${{ inputs.message }}\033[0m"
- name: "Report info message"
shell: bash
if: ${{ inputs.level == 'INFO' }}
if: ${{ inputs.level == 'INFO' && runner.os == 'Linux' }}
run: |
echo -e "\033[1;92m[INFO]: ${{ inputs.message }}\033[0m"
# ------------------------------- Windows --------------------------------

- name: "Report error message"
shell: powershell
if: ${{ inputs.level == 'ERROR' && runner.os == 'Windows' }}
run: |
Write-Host "$([char]27)[91m[ERROR]: ${{ inputs.message }}$([char]27)[0m"
- name: "Report warning message"
shell: powershell
if: ${{ inputs.level == 'WARNING' && runner.os == 'Windows' }}
run: |
Write-Host "$([char]27)[93m[WARNING]: ${{ inputs.message }}$([char]27)[0m"
- name: "Report info message"
shell: powershell
if: ${{ inputs.level == 'INFO' && runner.os == 'Windows' }}
run: |
Write-Host "$([char]27)[92m[INFO]: ${{ inputs.message }}$([char]27)[0m"

0 comments on commit f60ce81

Please sign in to comment.