added support for username variable for logging

This commit is contained in:
2026-03-27 13:11:42 -07:00
parent 1ba7810975
commit ae29dbab8b
5 changed files with 7 additions and 6 deletions

View File

@@ -55,7 +55,7 @@ Edit `config.psd1` before deploying:
| Key | Description | Default | | Key | Description | Default |
|---|---|---| |---|---|---|
| `UNCPath` | Base UNC path for clip storage — username subfolder created automatically | `\\server\ITCaptures` | | `UNCPath` | Base UNC path for clip storage — username subfolder created automatically | `\\server\ITCaptures` |
| `LogPath` | Base UNC path for script logs — username subfolder created automatically; each script writes its own log file | `\\server\ITLogs` | | `LogPath` | Directory path for script logs — supports `%USERNAME%` and other environment variables; each script writes its own log file | `\\server\ITLogs\%USERNAME%` |
| `BufferSeconds` | Replay buffer duration in seconds | `120` | | `BufferSeconds` | Replay buffer duration in seconds | `120` |
| `WebSocketPort` | OBS WebSocket port — must match `obs-config/plugin_config/obs-websocket/config.json` | `4455` | | `WebSocketPort` | OBS WebSocket port — must match `obs-config/plugin_config/obs-websocket/config.json` | `4455` |
| `OBSExecutable` | Full path to `obs64.exe` on the target machine | `C:\Program Files\obs-studio\bin\64bit\obs64.exe` | | `OBSExecutable` | Full path to `obs64.exe` on the target machine | `C:\Program Files\obs-studio\bin\64bit\obs64.exe` |

View File

@@ -2,9 +2,9 @@
# Base UNC path for saved clips — a subfolder per username is created automatically # Base UNC path for saved clips — a subfolder per username is created automatically
UNCPath = '\\server\ITCaptures' UNCPath = '\\server\ITCaptures'
# Base UNC path for script logs — a subfolder per username is created automatically # Directory path for script logs — supports %USERNAME% and other environment variables
# Each script writes its own log: OBSReplayBuffer.log, OBSReplayBuffer-Tray.log, OBSReplayBuffer-Save.log # Each script writes its own log: OBSReplayBuffer.log, OBSReplayBuffer-Tray.log, OBSReplayBuffer-Save.log
LogPath = '\\server\ITLogs' LogPath = '\\server\ITLogs\%USERNAME%'
# Replay buffer duration in seconds (120 = 2 minutes) # Replay buffer duration in seconds (120 = 2 minutes)
BufferSeconds = 120 BufferSeconds = 120

View File

@@ -21,7 +21,7 @@ if ($Port -eq 0) {
# --- Start transcript logging --- # --- Start transcript logging ---
try { try {
$logDir = Join-Path $config.LogPath $env:USERNAME $logDir = [System.Environment]::ExpandEnvironmentVariables($config.LogPath)
New-Item -ItemType Directory -Path $logDir -Force -ErrorAction SilentlyContinue | Out-Null New-Item -ItemType Directory -Path $logDir -Force -ErrorAction SilentlyContinue | Out-Null
Start-Transcript -Path (Join-Path $logDir 'OBSReplayBuffer-Save.log') -Append -ErrorAction Stop Start-Transcript -Path (Join-Path $logDir 'OBSReplayBuffer-Save.log') -Append -ErrorAction Stop
} catch { } catch {

View File

@@ -15,7 +15,7 @@ Add-Type -AssemblyName System.Drawing
# --- Start transcript logging --- # --- Start transcript logging ---
try { try {
$config = Import-PowerShellDataFile -Path (Join-Path $PSScriptRoot '..\config.psd1') $config = Import-PowerShellDataFile -Path (Join-Path $PSScriptRoot '..\config.psd1')
$logDir = Join-Path $config.LogPath $env:USERNAME $logDir = [System.Environment]::ExpandEnvironmentVariables($config.LogPath)
New-Item -ItemType Directory -Path $logDir -Force -ErrorAction SilentlyContinue | Out-Null New-Item -ItemType Directory -Path $logDir -Force -ErrorAction SilentlyContinue | Out-Null
Start-Transcript -Path (Join-Path $logDir 'OBSReplayBuffer-Tray.log') -Append -ErrorAction Stop Start-Transcript -Path (Join-Path $logDir 'OBSReplayBuffer-Tray.log') -Append -ErrorAction Stop
} catch { } catch {

View File

@@ -17,7 +17,7 @@ $config = Import-PowerShellDataFile -Path $configPath
# --- Start transcript logging --- # --- Start transcript logging ---
try { try {
$logDir = Join-Path $config.LogPath $env:USERNAME $logDir = [System.Environment]::ExpandEnvironmentVariables($config.LogPath)
New-Item -ItemType Directory -Path $logDir -Force -ErrorAction SilentlyContinue | Out-Null New-Item -ItemType Directory -Path $logDir -Force -ErrorAction SilentlyContinue | Out-Null
Start-Transcript -Path (Join-Path $logDir 'OBSReplayBuffer.log') -Append -ErrorAction Stop Start-Transcript -Path (Join-Path $logDir 'OBSReplayBuffer.log') -Append -ErrorAction Stop
} catch { } catch {
@@ -69,6 +69,7 @@ Write-Host "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') [INFO] Detected resolution
$obsConfigRoot = "$env:APPDATA\obs-studio" $obsConfigRoot = "$env:APPDATA\obs-studio"
$sourceConfig = Join-Path $PSScriptRoot '..\obs-config' $sourceConfig = Join-Path $PSScriptRoot '..\obs-config'
New-Item -ItemType Directory -Path $obsConfigRoot -Force | Out-Null
Copy-Item -Path "$sourceConfig\global.ini" -Destination "$obsConfigRoot\global.ini" -Force Copy-Item -Path "$sourceConfig\global.ini" -Destination "$obsConfigRoot\global.ini" -Force
$wsConfigDir = "$obsConfigRoot\plugin_config\obs-websocket" $wsConfigDir = "$obsConfigRoot\plugin_config\obs-websocket"