www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14940] New: Can't call logger with more complex objects

https://issues.dlang.org/show_bug.cgi?id=14940

          Issue ID: 14940
           Summary: Can't call logger with more complex objects
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: dmdtracker supradigital.org

I can't call the logger with any more complex objects. It used to work in the
older version in the dedicated repository before it was merged into phobos.

Example code:


import std.experimental.logger.filelogger;
import std.typecons: Nullable;
import std.stdio;

void main ( )
{
    Nullable!int a = 1;
    auto l = new FileLogger(stdout);
    l.infof("log: %s", l);
}


Error:

phobos/std/experimental/logger/core.d(1121): Error: safe function
'std.experimental.logger.core.Logger.memLogFunctions!cast(LogLevel)cast(ubyte)64u.logImplf!(11,
"main.d", "main.main", "void main.main()", "main", FileLogger).logImplf' cannot
call system function 'std.format.formattedWrite!(MsgRange, char,
FileLogger).formattedWrite'
main.d(11): Error: template instance
std.experimental.logger.core.Logger.memLogFunctions!cast(LogLevel)cast(ubyte)64u.logImplf!(11,
"main.d", "main.main", "void main.main()", "main", FileLogger) error
instantiating

--
Aug 20 2015