Open GoogleCodeExporter opened 9 years ago
In general a good idea in the right direction.
What I think is the main problem here: With the log being collected and echoed
later, it is difficult to see _where_ the log was produced. I mean SQL
statements in the end all are logged by the query() method, but that's not what
I want to know. I want to know where in the code the original call comes from.
With the SQL statement being echoed directly, I can easily see (guess) this.
I'm not saying this is the clean way to do this. I am just saying that your
suggestion makes debugging a little more difficult (at least for me :D) than
what we currently have.
But we can fix this: We can send the current position in the code to the Log
Class at all important points:
Log->position('Delete an existing database');
In the end this would be at the top of every method, currently it would be
spread all around index.php (where the "//-" comments are, I guess).
What do you think?
Another idea: Why not collecting Debug messages and other messages like errors,
warnings and so on in the same place? It is more or less a matter of the level.
There is not really a big difference between debug and normal messages. A Debug
message could be a message like others, only normally not being echoed.
Original comment by crazy4ch...@gmail.com
on 13 May 2014 at 7:05
> With the log being collected and echoed later, it is difficult to see _where_
> the log was produced.
I'm getting the filename:line information form the stack trace, so I could skip
the first level (Database->query) and show the second (the original caller). Or
show both, for clarity.
If you want additional 'locations', we just need to add some calls to
Log::info('Delete an existing database')
which will make the debug log nice and structured.
About collecting everything together: uhmmmm... it could work, or it could be a
very messy solution :) It definitely works for console programs for example,
where there is a single flow of output. But we want important messages to
appear near the top of the page, while the debug log should be out of the way,
maybe even collapsed by default. Also, result/warning messages would be more
complex than a single line, language dependent, etc.
Original comment by dreadnaut
on 13 May 2014 at 7:30
Here's a screenshot of the revised log, showing the full call stack for each
entry, and showing the four formats: query, info, error and dump.
Original comment by dreadnaut
on 19 May 2014 at 4:28
Attachments:
I like it. Go for it. Sorry for the late reply.
Original comment by crazy4ch...@gmail.com
on 22 May 2014 at 8:06
Here's a first patch then, with the following changes:
a) added a Log class;
b) initialize and output the Log in index.php;
c) replace output guarded by $debug with Log lines;
d) added css for the debug log.
A lot of debug output comes from alterTable(), could you double check my
changes in that function?
Regarding (d), the new build system introduced css and js minification, so we
can be more generous with comments and whitespace in new code :)
Original comment by dreadnaut
on 26 May 2014 at 5:05
Attachments:
Original issue reported on code.google.com by
dreadnaut
on 13 May 2014 at 4:43Attachments: