Skip to content

Commit 41541e9

Browse files
authored
Merge pull request #730 from lrdickson/master
Add configuration variable for log directory
2 parents 390c888 + 6fc337b commit 41541e9

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

autoload/OmniSharp.vim

+2-2
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ function! OmniSharp#Install(...) abort
431431
let l:location = shellescape(OmniSharp#util#ServerDir())
432432

433433
if has('win32')
434-
let l:logfile = s:plugin_root_dir . '\log\install.log'
434+
let l:logfile = OmniSharp#log#GetLogDir() . '\install.log'
435435
let l:script = shellescape(
436436
\ s:plugin_root_dir . '\installer\omnisharp-manager.ps1')
437437
let l:version_file_location = l:location . '\OmniSharpInstall-version.txt'
@@ -440,7 +440,7 @@ function! OmniSharp#Install(...) abort
440440
\ 'powershell -ExecutionPolicy Bypass -File %s %s -l %s %s',
441441
\ l:script, l:http, l:location, l:version)
442442
else
443-
let l:logfile = s:plugin_root_dir . '/log/install.log'
443+
let l:logfile = OmniSharp#log#GetLogDir() . '/install.log'
444444
let l:script = shellescape(
445445
\ s:plugin_root_dir . '/installer/omnisharp-manager.sh')
446446
let l:mono = g:OmniSharp_server_use_mono ? '-M' : ''

autoload/OmniSharp/log.vim

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
let s:save_cpo = &cpoptions
22
set cpoptions&vim
33

4-
let s:stdiologfile = expand('<sfile>:p:h:h:h') . '/log/stdio.log'
4+
if has('win32')
5+
let default_log_dir = expand('<sfile>:p:h:h:h') . '\log'
6+
else
7+
let default_log_dir = expand('<sfile>:p:h:h:h') . '/log'
8+
end
9+
10+
let s:logdir = get(g:, 'OmniSharp_log_dir', default_log_dir)
11+
let s:stdiologfile = s:logdir . '/stdio.log'
12+
13+
" Make the log directory if it doesn't exist
14+
if !isdirectory(g:OmniSharp_log_dir)
15+
call mkdir(g:OmniSharp_log_dir, 'p')
16+
end
17+
18+
function! OmniSharp#log#GetLogDir() abort
19+
return s:logdir
20+
endfunction
521

622
" Log from OmniSharp-vim
723
function! OmniSharp#log#Log(job, message, ...) abort

doc/omnisharp-vim.txt

+10
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ to 1, omnisharp-vim will translate the cygwin/WSL unix paths into Windows paths
106106
and back.
107107
Default: 0 >
108108
let g:OmniSharp_translate_cygwin_wsl = 1
109+
<
110+
*g:OmniSharp_log_dir*
111+
Sets the log directory.
112+
113+
Use this option to specify the directory log files will be written to. If the
114+
directory specified does not exist, it will be created. When no log directory is
115+
specified, logs are written to the log directory in the Omnisharp-vim plugin
116+
directory.
117+
Default: /omnisharp-vim/log >
118+
let g:OmniSharp_log_dir = '/omnisharp-vim/log'
109119
<
110120
*g:OmniSharp_loglevel*
111121
Sets the log level.

0 commit comments

Comments
 (0)