Fix Issue 15771 - FileLogger should create the output directory if it does not exist#5594
Conversation
|
Thanks for your pull request, @RazvanN7! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. Bugzilla references
|
|
Has anyone an idea why the CODEOWNERS file didn't work here? |
People should leave links to their PRs on the Bugzilla pages. |
|
Damn... I usually try to reproduce the bug and if that happens I assume that nobody has fixed it. Obviously not such a good methodology. So how do we go on from here? Should I close this? |
But people forget (maybe the bot should).
Yeah, @burner's PR is a bit more polished. |
| assert(!exists(filepath)); | ||
|
|
||
| auto f = new FileLogger(filename, LogLevel.all, CreateFolder.yes); | ||
| scope(exit) () @trusted { rmdirRecurse(tmpFolder ~ "/bug15771"); }(); |
There was a problem hiding this comment.
| Params: | ||
| file = The file used for logging. | ||
| lv = The $(D LogLevel) for the $(D FileLogger). By default the | ||
| $(D LogLevel) for $(D FileLogger) is $(D LogLevel.all). |
There was a problem hiding this comment.
CI error:
std/experimental/logger/filelogger.d(40): Warning: Ddoc: function declaration has no parameter 'createFileNameFolder'
std/experimental/logger/filelogger.d(40): Warning: Ddoc: parameter count mismatch
std/experimental/logger/filelogger.d(64): Warning: Ddoc: function declaration has no parameter 'file'
std/experimental/logger/filelogger.d(64): Warning: Ddoc: parameter count mismatch
Better rename fn etc. in the first overload as well then.
std/experimental/logger/filelogger.d
Outdated
| { | ||
| import std.file : rmdirRecurse, exists; | ||
| import std.path : dirName; | ||
| import std.file : deleteme; |
There was a problem hiding this comment.
Combine with the first import?
std/experimental/logger/filelogger.d
Outdated
|
|
||
| import std.typecons : Flag; | ||
|
|
||
| /** An option for a $(D FileLogger) constructor to possibly create the folder the |
There was a problem hiding this comment.
How about: "to create $(LREF FileLogger) directory if it's not existent?"
std/experimental/logger/filelogger.d
Outdated
| { | ||
| auto d = dirName(this.filename); | ||
| mkdirRecurse(d); | ||
| assert(exists(d), text("The folder the FileLogger should have been", |
There was a problem hiding this comment.
s/have been/have/ or "should have been created by the FileLogger"
|
@wilzbach done. hope this does it. |
|
@RazvanN7 could you squash and then I'll merge this |
|
@burner Done. Sorry for taking your code like that 🗡️ |
I added an optional parameter to the constructor of FileLogger which specifies if the Logger should create the directory path offered. It defaults to false.