Skip to content

Commit

Permalink
Merge pull request #3935 from MartinNowak/merge_stable
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'upstream/stable' into merge_stable
  • Loading branch information
MartinNowak committed Jan 25, 2016
2 parents 6be2087 + 10d1dc4 commit 581574e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
3 changes: 3 additions & 0 deletions changelog.dd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ $(COMMENT Pending changelog for 2.069. This will get copied to dlang.org and
$(BUGSTITLE Library Changes,

$(LI $(RELATIVE_LINK2 json-encode-control-characters, `std.json` encodes string control characters.))
$(LI The package $(STDMODREF experimental_ndslice, std.experimental.ndslice) was added.
It is also available as part of the $(LINK2 https://github.com/DlangScience/mir, Mir library).)
$(LI Default LogLevel of FileLogger was changed to LogLevel.all.)

)

Expand Down
2 changes: 1 addition & 1 deletion std/algorithm/sorting.d
Original file line number Diff line number Diff line change
Expand Up @@ -2228,7 +2228,7 @@ Stable topN has not been implemented yet.
auto topN(alias less = "a < b",
SwapStrategy ss = SwapStrategy.unstable,
Range)(Range r, size_t nth)
if (isRandomAccessRange!(Range) && hasLength!Range)
if (isRandomAccessRange!(Range) && hasLength!Range && hasSlicing!Range)
{
static assert(ss == SwapStrategy.unstable,
"Stable topN not yet implemented");
Expand Down
8 changes: 4 additions & 4 deletions std/experimental/logger/filelogger.d
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class FileLogger : Logger
fn = The filename of the output file of the $(D FileLogger). If that
file can not be opened for writting an exception will be thrown.
lv = The $(D LogLevel) for the $(D FileLogger). By default the
$(D LogLevel) for $(D FileLogger) is $(D LogLevel.info).
$(D LogLevel) for $(D FileLogger) is $(D LogLevel.all).
Example:
-------------
auto l1 = new FileLogger("logFile", "loggerName");
auto l2 = new FileLogger("logFile", "loggerName", LogLevel.fatal);
-------------
*/
this(in string fn, const LogLevel lv = LogLevel.info) @safe
this(in string fn, const LogLevel lv = LogLevel.all) @safe
{
import std.exception : enforce;
super(lv);
Expand All @@ -45,7 +45,7 @@ class FileLogger : Logger
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.info).
$(D LogLevel) for $(D FileLogger) is $(D LogLevel.all).
Example:
-------------
Expand All @@ -54,7 +54,7 @@ class FileLogger : Logger
auto l2 = new FileLogger(file, "LoggerName", LogLevel.fatal);
-------------
*/
this(File file, const LogLevel lv = LogLevel.info) @safe
this(File file, const LogLevel lv = LogLevel.all) @safe
{
super(lv);
this.file_ = file;
Expand Down
19 changes: 10 additions & 9 deletions std/experimental/logger/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ required $(D Logger).
$(H3 Logging Fundamentals)
$(H4 LogLevel)
The $(D LogLevel) of an log call can be defined in two ways. The first is by
The $(D LogLevel) of a log call can be defined in two ways. The first is by
calling $(D log) and passing the $(D LogLevel) explicit as the first argument.
The second way of setting the $(D LogLevel) of a
log call, is by calling either $(D trace), $(D info), $(D warning),
Expand Down Expand Up @@ -98,11 +98,12 @@ The global $(D LogLevel) is accessible by using $(D globalLogLevel).
To assign the $(D LogLevel) of a $(D Logger) use the $(D logLevel) property of
the logger.
$(H4 Printf Sytle Logging)
$(H4 Printf Style Logging)
If $(D printf)-style logging is needed add a $(B f) to the logging call, such as
$(D myLogger.infof("Hello %s", "world");) or $(fatalf("errno %d", 1337))
The additional $(B f) enables $(D printf)-style logging for call combinations of
explicit $(D LogLevel) and conditional logging functions and methods.
$(D myLogger.infof("Hello %s", "world");) or $(D fatalf("errno %d", 1337)).
The additional $(B f) appended to the function name enables $(D printf)-style
logging for all combinations of explicit $(D LogLevel) and conditional
logging functions and methods.
$(H4 Thread Local Redirection)
Calls to the free standing log functions are not directly forwarded to the
Expand All @@ -123,9 +124,9 @@ method.
-------------
class MyCustomLogger : Logger
{
this(string newName, LogLevel lv) @safe
this(LogLevel lv) @safe
{
super(newName, lv);
super(lv);
}
override void writeLogMsg(ref LogEntry payload)
Expand All @@ -134,8 +135,8 @@ class MyCustomLogger : Logger
}
}
auto logger = new MyCustomLogger();
logger.log("Awesome log message");
auto logger = new MyCustomLogger(LogLevel.info);
logger.log("Awesome log message with LogLevel.info");
-------------
To gain more precise control over the logging process, additionally to
Expand Down

0 comments on commit 581574e

Please sign in to comment.