Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add std.experimental.logger.asynclogger #3194

Closed
wants to merge 1 commit into from

Conversation

Groterik
Copy link
Contributor

Asynchronous wrapper for std.experimental.logger. It sends log-message to special logging thread where the message is logged finally.
Discussion: http://forum.dlang.org/thread/lcsjtxorbbagmbvbllns@forum.dlang.org

{
super(lv);
_logger = cast(shared Logger)(logger);
_tid = spawn(&(spawnedFunc), _logger);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the parens? It looks as if you want to take the address of the return value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use "this"

@MartinNowak
Copy link
Member

Rest LGTM.

SysTime timestamp;
/// the message of the log message
string msg;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this struct feels wrong. could you mix that with LogEntry into something like

struct LogEntryBase {
    // all but Tid
}

struct LogEntry {
    LogEntryBase base;
    Tid threadId;
}


/// thread id of the log message
Tid threadId;
/// A reference to the $(D Logger) used to create this $(D LogEntry)
Logger logger;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

holding a ref to the Logger seams wrong. as LogEntry is only a aggregation of Log Data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field was in original LogEntry and LogEntry was/is protected. Potentially this change can break user code. May be it is better to remove this field by separate commit, just in case.

@burner
Copy link
Member

burner commented Jun 8, 2015

@Groterik ping

@Groterik
Copy link
Contributor Author

Groterik commented Jun 9, 2015

Sorry for the delay, it seems that Unique has got some improvements. I'm going to fix this as soon as I can, presumably during this week.

@Groterik Groterik reopened this Jul 6, 2015
@Groterik
Copy link
Contributor Author

Groterik commented Jul 6, 2015

Now AsyncLogger acquires underlying logger ownership.
Still opened questions: send termination message in destructor or not; LogEntry and LogEntryBase are little bit messy in my opinion. Any suggestions will be appreciated.

import std.concurrency;
public import std.typecons : Unique, unique;

/** The $(D AsyncLogger) processes logs asynchronously by using another $(D Logger) implementation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the first sentences is confusing:

the act of using another logger does not make it asynchronously

please rewrite

@9il
Copy link
Member

9il commented Jan 11, 2016

ping

@wilzbach
Copy link
Member

merge failed - please rebase.

@wilzbach
Copy link
Member

ping @Groterik - it still needs a rebase and addressing of the comments..

@JackStouffer
Copy link
Member

This PR has been inactive for almost a year, I suggest this be closed due to inactivity.

@wilzbach
Copy link
Member

wilzbach commented Jun 2, 2016

This PR has been inactive for almost a year, I suggest this be closed due to inactivity.

Async logging seems to be important. Anyone interested in picking this up or at least putting to dub?

@kookman
Copy link

kookman commented Aug 9, 2016

I'd be interested in seeing this available - at least on dub. In its current form it requires a change to Phobos to work however: std.experimental.logger.core (splitting LogEntry into LogEntryBase without Tid).
Is there some way I can help?

@burner
Copy link
Member

burner commented Aug 9, 2016

You could takeover this PR by recreating this patch in another PR. @Groterik seams to be inactive with this PR.

@kookman
Copy link

kookman commented Aug 12, 2016

I'm looking into this to see whether I can see a way to do it with no Phobos change first.

@kookman
Copy link

kookman commented Aug 15, 2016

@burner I have some questions on the design of std.experimental.logger, mainly relating to threading aspects. What is the best forum for these, here? dlang forums? PM? somewhere else?

@wilzbach
Copy link
Member

@burner I have some questions on the design of std.experimental.logger, mainly relating to threading aspects. What is the best forum for these, here? dlang forums? PM? somewhere else?

I think such a discussion could be interesting for more people, so how about general in the NG?

@wilzbach
Copy link
Member

This PR has been inactive for almost a year, I suggest this be closed due to inactivity.

Agreed @Groterik, @kookman or anyone else: please reopen to revive this PR. Also I created a Bugzilla enhancement request, s.t. it's not forgotten.

@burner I think this would be a pretty cool enhancement to the logging module (and is probably one of the missing bits to move it out of experimental). Maybe you have some time?

@wilzbach wilzbach closed this Dec 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants