Skip to content

Commit

Permalink
Merge pull request #3400 from burner/logger_less_code_better_debugging
Browse files Browse the repository at this point in the history
logger cleanup2:
  • Loading branch information
andralex committed Jun 12, 2015
2 parents fd95fa7 + eb9b3b1 commit b02ea54
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
15 changes: 3 additions & 12 deletions std/experimental/logger/core.d
Expand Up @@ -1804,16 +1804,6 @@ unittest
stdThreadLocalLog = l;
}

@trusted package string randomString(size_t upto)
{
import std.ascii : letters;
import std.random : uniform;
auto app = Appender!string();
foreach (_ ; 0 .. upto)
app.put(letters[uniform(0, letters.length)]);
return app.data;
}

@safe unittest
{
LogLevel ll = globalLogLevel;
Expand Down Expand Up @@ -2083,7 +2073,8 @@ version(unittest) private void testFuncNames(Logger logger) @safe
unittest // default logger
{
import std.file : exists, remove;
string filename = randomString(32) ~ ".tempLogFile";

string filename = __FUNCTION__ ~ ".tempLogFile";
FileLogger l = new FileLogger(filename);
auto oldunspecificLogger = sharedLog;
sharedLog = l;
Expand Down Expand Up @@ -2121,7 +2112,7 @@ unittest
{
import std.file : remove;
import core.memory : destroy;
string filename = randomString(32) ~ ".tempLogFile";
string filename = __FUNCTION__ ~ ".tempLogFile";
auto oldunspecificLogger = sharedLog;

scope(exit)
Expand Down
4 changes: 2 additions & 2 deletions std/experimental/logger/filelogger.d
Expand Up @@ -135,7 +135,7 @@ unittest
import std.array : empty;
import std.string : indexOf;

string filename = randomString(32) ~ ".tempLogFile";
string filename = __FUNCTION__ ~ ".tempLogFile";
auto l = new FileLogger(filename);

scope(exit)
Expand Down Expand Up @@ -164,7 +164,7 @@ unittest
import std.array : empty;
import std.string : indexOf;

string filename = randomString(32) ~ ".tempLogFile";
string filename = __FUNCTION__ ~ ".tempLogFile";
auto file = File(filename, "w");
auto l = new FileLogger(file);

Expand Down
2 changes: 1 addition & 1 deletion std/experimental/logger/multilogger.d
Expand Up @@ -143,7 +143,7 @@ unittest
{
import std.stdio : File;
import std.string : indexOf;
auto logName = randomString(32) ~ ".log";
string logName = __FUNCTION__ ~ ".log";
auto logFileOutput = File(logName, "w");
scope(exit)
{
Expand Down

0 comments on commit b02ea54

Please sign in to comment.