patch 8.2.4742: there is no way to start logging very early in startup
Problem: There is no way to start logging very early in startup.
Solution: Add the --log argument. Include the date in the start message in
the log file. Avoid a duplicate message when forking. Log an
executed shell command.
diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim
index 6926ba3..c580dd0 100644
--- a/src/testdir/test_startup.vim
+++ b/src/testdir/test_startup.vim
@@ -726,6 +726,25 @@
call delete('Xtestout')
endfunc
+func Test_log()
+ CheckFeature channel
+
+ call assert_false(filereadable('Xlogfile'))
+ let after = ['qall']
+ if RunVim([], after, '--log Xlogfile')
+ call assert_equal(1, readfile('Xlogfile')
+ \ ->filter({i, l -> l =~ '==== start log session'})
+ \ ->len())
+ " second time appends to the log
+ if RunVim([], after, '--log Xlogfile')
+ call assert_equal(2, readfile('Xlogfile')
+ \ ->filter({i, l -> l =~ '==== start log session'})
+ \ ->len())
+ endif
+ endif
+ call delete('Xlogfile')
+endfunc
+
func Test_read_stdin()
let after =<< trim [CODE]
write Xtestout