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

Issue 1738 advanced console formatted #2484

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@aaronstaves

aaronstaves commented Jul 8, 2018

I've put this off for a while just because I've had stuff working locally and haven't had a need for it.

This is a pretty simple addition, but could easily be tweaked going forward if need be. For now I've just extended AdvancedConsoleLogger and just added in the bits we'd need to format SQL for logQuery calls. I'm completely open to reworking this if another method is preferred (i.e. build this into it's own standalone logger).

One thing I did notice on one comment a while back, someone was complaining about extra packages included for the debug/loggers. I'm wondering if it would be worthwhile to just add this as a separate package, something like @typeorm/advanced-console-formatted and then people can import and use it as they see fit.

Anyways, apologies again for not following through on this sooner. Let me know if/how this needs to be reworked. Right now I just want to get this out there to discuss and see what, if anything, fails in the pipeline. Thanks!

Aaron Staves added some commits Jul 8, 2018

Aaron Staves
Add AdvancedConsoleFormattedLogger
Just extends AdvancedConsoleLogger but formats sql for logQuery
calls and passes it on to AdvancedConsoleLogger

issue-1738

@aaronstaves aaronstaves reopened this Jul 10, 2018

import {QueryRunner} from "../query-runner/QueryRunner";
import {Logger} from "./Logger";
import { AdvancedConsoleLogger } from "./AdvancedConsoleLogger";
const sqlFormatter = require("sql-formatter"); // use require because there"s no type definition

This comment has been minimized.

@pleerock

pleerock Jul 11, 2018

Member

please load it via PlatformTools (we load all external dependencies using that class)

@pleerock

This comment has been minimized.

Member

pleerock commented Jul 11, 2018

Anyways, apologies again for not following through on this sooner.

Its open source and any efforts even latest ones are highly appreciated! Thank you!

. I'm wondering if it would be worthwhile to just add this as a separate package, something like @typeorm/advanced-console-formatted and then people can import and use it as they see fit.

I hope we'll do things this way in the future.

@pleerock

This comment has been minimized.

Member

pleerock commented Jul 11, 2018

Can you please add documentation to the new logger (you can attach screenshot btw)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment