Audit Log File#12710
Conversation
|
Thanks for your pull request and interest in making D better, @12345swordy! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#12710" |
|
@thewilsonator why the bot label this as need work when this is in draft mode? |
Probably because all checks fail. |
|
I'd still like to see a compelling argument for what use this is. I can't think of a single case in all my years of debugging where a 10,000 line log file of scattershot, unfocused messages would have been helpful. |
Then simply don't use it. The logging system is driven by compiler commands. If you want to see a logging output for a particular function or module then pass said value to the compiler command. The logging system is design to be pay as you go. As I and others said before, this is part of dlang/project-ideas#79 project. |
|
@thewilsonator wrapping the "else if" statement in a debug condition causes the program to not compile. Is this a bug? |
|
Don't think so, you can't interleave compile time and runtime conditionals |
|
@12345swordy @WalterBright seems to be opposing this addition. You need to come with a compelling case for it, otherwise this will not get accepted. |
|
@RazvanN7 What I want to know if @WalterBright is against dlang/project-ideas#79 as an concept in general, before I pursue this pr any further. As of right now, I have lost all my motivation regarding this PR. |
In debug builds at least, having all logging merely a branch away versus turned off via conditional compilation would actually be quite useful if done properly. Currently tracking down what the compiler is doing when debugging (i.e. the stage in between guessing and actually trying a specific fix) is basically a mixture of undoing a bunch of random printfs which may or may not have enough detail or some static ifs. For release builds that we ship I don't think we need logging. That being said however it is very common now to look into the compilers state when discussing code (e.g. looking at LLVM IR, or GCC GIMPLE/RTL etc.), so a more something along these lines would be good (e.g. dumping the AST in between semantic operations, tracking what changes). |
Right, logging to console by default is the wrong approach. You want each logical component (The current Visitors are a good marker for a boundary) to write to its own stream. |
|
All green now. |
Change file location in readme
|
This PR is hard to review because it introduces a piece of reusable code with 0 users. @WalterBright doesn't see the use of this. I see several problems with the current practice of So how could we move forward? My proposal is:
void dbg(T...)(string fmt, T args, string file = __FILE__, int line = __LINE__)
{
printf(fmt.toCstring, args);
}
|
|
The reason why @ibuclaw told me to output to a file instead of outputting to the console, is because he doesn't want me to replace the ```//printf```` statements that walter uses. Thus there are no plans of replacing the printf statements scatter around the dmd source files. |
How is audit_log.d going to be used then?
What was his reason? |
See here under the "How does this project help the D community?" section. |
That project still mentions replacing printf statements with the log statements. If you're not doing that, then are you going to write log statements in addition to the printf statements? |
That was before I had talk with @ibuclaw regarding requirements.
No, I am just leaving the printf stuff alone to Walter, while writing log statements, per requirement set by other people. If you have any further questions regarding the reasoning behind the requirements then contact @ibuclaw and @maxhaton via email please. |
Okay, so the project page is outdated, and based on verbal discussion these requirements were established:
That still doesn't explain where in dmd's source audit_log is going to be used and to what end. Let's say for example: it's going to be used to log expression semantic. Currently there's these statements everywhere: static if (LOGSEMANTIC)
{
printf("ImportExp::semantic('%s')\n", e.toChars());
}Are you going to write |
|
I think the best place to put these is in between "passes" (or the closest thing dmd has to passes) a la GCC. The printfs should be replaced by something else. Walter has previously said that a large dump of info is not useful, I think this is false - although the info should be structured better than a mere printf. |
Look at this PR discussion please. I have tried replacing them, only for it to be rejected. |
That doesn't answer my question. |
See here under the "How does this project help the D community?" section. |
I'm not asking about the high level goal of a logging system, I'm talking about this PR and audit_log.d specifically. Give me a spot in DMD (file and line number) where I could expect a call to |
|
|
That doesn't give a file and line number. |
|
"How I would use this" is not relevant to this PR. The usage of this PR will be implemented separately from this PR. Asking for example usage of this makes no sense. |
It's absolutely relevant. This PR adds a module with dead code. It introduces functions that are never called, let alone tested. There's no documentation, no bugzilla issue, Walter wants to see a compelling argument for it but the only rationale provided is an outdated issue in dlang/projects with an abstract goal. I can comment on the code style, but this PR as a whole is unreviewable like this. I tried to gather rationale with the questions in my past comments, but to no avail. The fact that you won't provide me a single potential call site of the
I'm not sure exactly what you mean, but if you're fed up with this, we can close this and let someone else take over with a new PR. If you want to champion this PR, you should provide a single up-to-date piece of rationale for its code changes. |
No it is not! I told @maxhaton in the discord server MONTHS AGO that this will be follow up with with separated PRs. Neither @ibuclaw, @maxhaton or even @RazvanN7 object to this. You are the literally only one who object to this PR that is in months of development here. |
|
Rant: This here is an example of poor management that discourage me from recommending D to other people here. Dear god no wonder other people have stop contributing to D over the years here, and move to other languages here. I am beating my head against the wall. Keep this poor management up and you kiss good bye to the properties rework that I am in current development. |
IMO this is the problem here—the fact that design decisions are being made "behind the scenes," without any written record, rather than out in the open. I understand how frustrating it is to repeat yourself over and over about this kind of thing, believe me, but the solution to that problem is to write things down publicly. Not only does this make it easier for a third party like Dennis to review, it makes it easier for anyone doing code archaeology in the future to understand how and why decisions were made. To give a concrete example: a while ago, I tried to track down the rationale behind why we have both
Decided by who? For what reasons? The world will never know. The decision was made in private, nobody wrote anything down about it, and the knowledge is now lost forever. |
|
@pbackus Fair point on this. I have cool my head down on this already, and I apologize to @dkorpel if I were rude or aggrasive to him. I originally plan to replace printf statements with this until, I had talk with @ibuclaw via discord and via beerconf and told me to leave printf alone and just output the results to a file and have the file be define by module and by function call when initially design this. StringExp semanticString(Scope *sc, Expression exp, const char* s)Try to see the string value of Expression exp via .toChars() and try to see what it is returning, I.E. return se;Most importantly for me is backtracking the flow of log when the compiler had error as it is hard to backtrack when you have a visitor pattern implementation. Regarding the rational regarding why leaving printf alone and to output to a file. I honestly can't help you there, as I never ask @ibuclaw why on this and just do as I been told to do. |
No worries, I understand your frustration.
The main objection comes from Walter (#12710 (comment)), I'm actually in favor of the project as a whole. I want to prevent the following situation:
That's why I need a concrete direction and scope of this project, so it can get approved by Walter. Chances are if he doesn't want to replace
Thanks for the specific example.
I agree
This is important for you to know, because if you blindly follow a rule like that, you may technically comply, but still fail to address the underlying issue. If the underlying issue is "Walter doesn't want log statements other than |
In discordMe: Do you know why @ibuclaw wants me to leave the printf statements alone when developing the log pr? Max: Aim to add infrastructure to mimic what GCC does (look at GDC on godbolt.org to see what I mean), the printfs require either an extension to that or a different approach entirely
Welcome to my work place where you are required to follow rules and not ask any question regarding the rational behind the requirements. |
The audit log file itself. Current in draft for proof of concept for other people before any further development.
CC @RazvanN7 @dkorpel any suggestions?
Related PR: #12636