Is std.experimental.logger FileLogger thread safe?

2019-02-25 Thread Andre Pany via Digitalmars-d-learn
Hi, I am using the Arsd cgi class (https://github.com/adamdruppe/arsd) to spawn an http server. Each http request is handled in its own thread. Is it safe to set in void main a FileLogger to which each thread will write to? void main() { ... sharedLog = new FileLogger("New_Default_Log_File.l

Re: std.experimental.logger + threadIds

2016-12-19 Thread Christian Köstlin via Digitalmars-d-learn
On 19/12/2016 21:32, Robert burner Schadek wrote: > The ugly way is to create a @trusted function/lambda that coverts the > threadId to a string. > > Not sure about the pretty way. thanks a lot. works good enough, just for reference, I added: string tid2string(Tid id) @trusted { import std.conv

Re: std.experimental.logger + threadIds

2016-12-19 Thread Robert burner Schadek via Digitalmars-d-learn
The ugly way is to create a @trusted function/lambda that coverts the threadId to a string. Not sure about the pretty way.

std.experimental.logger + threadIds

2016-12-19 Thread Christian Köstlin via Digitalmars-d-learn
I am experimenting with the logger interface and want to write a custom logger, that also outputs the threadID or Tid of the LogEntries. The documentation shows how to do a custom logger, but I am unable to convert the threadId to a string, because all conversion functions are not @safe. Is there

Re: is module ( std.experimental.logger) thread-safe.

2016-03-10 Thread Dsby via Digitalmars-d-learn
On Thursday, 10 March 2016 at 23:56:14 UTC, ZombineDev wrote: On Sunday, 6 March 2016 at 09:54:49 UTC, Dsby wrote: I want to use the filelogger to my application. is the sharedLog() global and thread-safe. Yes, `FileLogger` internally uses `lockingTextWriter`, so it should be safe to call

Re: is module ( std.experimental.logger) thread-safe.

2016-03-10 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 6 March 2016 at 09:54:49 UTC, Dsby wrote: I want to use the filelogger to my application. is the sharedLog() global and thread-safe. Yes, `FileLogger` internally uses `lockingTextWriter`, so it should be safe to call from multiple threads. Furthermore, the `sharedLog` property u

is module ( std.experimental.logger) thread-safe.

2016-03-06 Thread Dsby via Digitalmars-d-learn
I want to use the filelogger to my application. is the sharedLog() global and thread-safe.

concurrency and standard logger of std.experimental.logger

2016-01-09 Thread sanjayss via Digitalmars-d-learn
Is there a way to include some form of thread-id in the standard logger log messages without resorting to the use of the 'f' functions to log this info too?

Re: std.experimental.logger

2016-01-05 Thread sanjayss via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 09:18:21 UTC, Robert burner Schadek wrote: On Tuesday, 5 January 2016 at 02:44:48 UTC, sanjayss wrote: I'm doing the following: import std.experimental.logger; int main(string[] args) { sharedLog = new FileLogger("logfile.log"); log("Test lo

Re: std.experimental.logger

2016-01-05 Thread Robert burner Schadek via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 02:44:48 UTC, sanjayss wrote: I'm doing the following: import std.experimental.logger; int main(string[] args) { sharedLog = new FileLogger("logfile.log"); log("Test log 1"); log("Test log 2"); log("Test log 3"); }

Re: std.experimental.logger

2016-01-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, January 05, 2016 03:01:14 Mike via Digitalmars-d-learn wrote: > You are right, according to the docs your example should've > worked just fine. Tried it myself on DMD 2.069.2 and it doesn't > work either. You should raise an issue on github. We don't use the issue system on github. We

Re: std.experimental.logger

2016-01-04 Thread Mike via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 02:59:04 UTC, sanjayss wrote: On Tuesday, 5 January 2016 at 02:49:01 UTC, Mike wrote: [...] Thanks, that works. But the docs are confusing -- it gives the impression that "sharedLog" is something associated with the default logger -- so I would expect the above

Re: std.experimental.logger

2016-01-04 Thread sanjayss via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 02:49:01 UTC, Mike wrote: On Tuesday, 5 January 2016 at 02:44:48 UTC, sanjayss wrote: I'm doing the following: import std.experimental.logger; int main(string[] args) { sharedLog = new FileLogger("logfile.log"); log("Test log 1"); log

Re: std.experimental.logger

2016-01-04 Thread Mike via Digitalmars-d-learn
On Tuesday, 5 January 2016 at 02:44:48 UTC, sanjayss wrote: I'm doing the following: import std.experimental.logger; int main(string[] args) { sharedLog = new FileLogger("logfile.log"); log("Test log 1"); log("Test log 2"); log("Test log 3");

std.experimental.logger

2016-01-04 Thread sanjayss via Digitalmars-d-learn
I'm doing the following: import std.experimental.logger; int main(string[] args) { sharedLog = new FileLogger("logfile.log"); log("Test log 1"); log("Test log 2"); log("Test log 3"); } and I expected the logs to be seen in the logfile.log, but it

Re: How to use std.experimental.logger?

2015-10-01 Thread Panke via Digitalmars-d-learn
Ah, I tried to format a custom struct that has a non-pure toString, because std.conv.to isn't pure either, sigh :(

Re: How to use std.experimental.logger?

2015-10-01 Thread Adrian Matoga via Digitalmars-d-learn
x27; How do I make formatted logging work? Would be easier to diagnose your problem if you pasted your code and uncut complaint from the compiler. Anyway, the following works, so it may give you a hint: $ cat log.d import std.experimental.logger; void main() { logf("just log %s

How to use std.experimental.logger?

2015-10-01 Thread Panke via Digitalmars-d-learn
I tried it on Windows today using the latest DMD installer, all default logger and settings. I get: safe function [...].logImplf cannot call system function 'std.format.formattedWrite!(MsgRange, char, Result!()).formattedWrite' How do I make formatted logging work?

Re: std.experimental.logger instantiation fails in 2.067

2015-09-02 Thread Robert burner Schadek via Digitalmars-d-learn
my guess is that InitiatingPTrack.toString is not @safe

Re: std.experimental.logger instantiation fails in 2.067

2015-09-02 Thread drug via Digitalmars-d-learn
On 02.09.2015 11:36, Robert burner Schadek wrote: On Wednesday, 2 September 2015 at 06:57:12 UTC, drug wrote: Before 2.067 I used std.experimental.logger in form of a dub package. Because it included in 2.067 I stop using the dub package but now I get the error: Error: safe function

Re: std.experimental.logger instantiation fails in 2.067

2015-09-02 Thread Robert burner Schadek via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 06:57:12 UTC, drug wrote: Before 2.067 I used std.experimental.logger in form of a dub package. Because it included in 2.067 I stop using the dub package but now I get the error: Error: safe function 'std.experimental.logger.core.Logger.memLogFunctions

std.experimental.logger instantiation fails in 2.067

2015-09-02 Thread drug via Digitalmars-d-learn
Before 2.067 I used std.experimental.logger in form of a dub package. Because it included in 2.067 I stop using the dub package but now I get the error: Error: safe function 'std.experimental.logger.core.Logger.memLogFunctions!cast(LogLevel)cast(ubyte)32u.logImplf!(383, [snip]).log