Skip to content

Commit

Permalink
Update if log is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jvlflame committed Sep 1, 2020
1 parent 474a36b commit 6a94da5
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/Javinizer/Public/Javinizer.ps1
Expand Up @@ -312,27 +312,27 @@ function Javinizer {
} else {
$settingsPath = Join-Path -Path ((Get-Item $PSScriptRoot).Parent) -ChildPath 'jvSettings.json'
}

$Settings = Get-Content -LiteralPath $settingsPath | ConvertFrom-Json -Depth 32
} catch {
Write-Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when loading settings file [$settingsPath]: $PSItem" -ErrorAction Stop
}

if ($Settings.'admin.log.path' -eq '') {
$logPath = Join-Path -Path ((Get-Item $PSScriptRoot).Parent) -ChildPath 'jvLog.log'
} else {
if (!(Test-Path -LiteralPath $Settings.'admin.log.path' -PathType Leaf)) {
New-Item -LiteralPath $Settings.'admin.log.path'
if ($Settings.'admin.log' -eq '1') {
if ($Settings.'admin.log.path' -eq '') {
$logPath = Join-Path -Path ((Get-Item $PSScriptRoot).Parent) -ChildPath 'jvLog.log'
} else {
if (!(Test-Path -LiteralPath $Settings.'admin.log.path' -PathType Leaf)) {
New-Item -LiteralPath $Settings.'admin.log.path'
}
$logPath = $Settings.'admin.log.path'
}
Add-LoggingTarget -Name File -Configuration @{
Path = $logPath
Append = $true
Encoding = 'utf8'
Level = $Settings.'admin.log.level'
Format = '[%{timestamp}] [%{level:-7}] %{message}'
}
$logPath = $Settings.'admin.log.path'
}

Add-LoggingTarget -Name File -Configuration @{
Path = $logPath
Append = $true
Encoding = 'utf8'
Level = $Settings.'admin.log.level'
Format = '[%{timestamp}] [%{level:-7}] %{message}'
}

if ($Settings.'sort.metadata.thumbcsv.path' -eq '') {
Expand Down

0 comments on commit 6a94da5

Please sign in to comment.