mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 01:50:44 +08:00
feat: unify runtime logging (rotating files, log root, scripts, desktop)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
86d4bad107
commit
1490bd5f24
25 changed files with 541 additions and 53 deletions
23
runtime/operations/scripts/lib/ResolveRuntimeLogDir.ps1
Normal file
23
runtime/operations/scripts/lib/ResolveRuntimeLogDir.ps1
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Shared: resolve the same directory as Python ``assistant_runtime_log_dir()`` / ``AIA_RUNTIME_LOG_DIR``.
|
||||
function Get-OclawRuntimeLogDir {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)][string]$RepoRoot
|
||||
)
|
||||
$venvPython = Join-Path $RepoRoot ".venv\Scripts\python.exe"
|
||||
$pythonExe = if (Test-Path $venvPython) { $venvPython } else { "python" }
|
||||
$savedPyPath = $env:PYTHONPATH
|
||||
$env:PYTHONPATH = $RepoRoot
|
||||
$dir = $null
|
||||
try {
|
||||
$dir = (& $pythonExe -c "from runtime.operations.runtime import assistant_runtime_log_dir; print(str(assistant_runtime_log_dir()))" 2>$null | Select-Object -Last 1).Trim()
|
||||
} catch { }
|
||||
if ($null -ne $savedPyPath) {
|
||||
$env:PYTHONPATH = $savedPyPath
|
||||
} else {
|
||||
Remove-Item Env:PYTHONPATH -ErrorAction SilentlyContinue
|
||||
}
|
||||
if (-not $dir) {
|
||||
$dir = Join-Path $RepoRoot "data\logs"
|
||||
}
|
||||
return $dir
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue