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

tech(fmt): use wasm logging #4919

Merged
merged 3 commits into from
Jun 13, 2024
Merged

tech(fmt): use wasm logging #4919

merged 3 commits into from
Jun 13, 2024

Conversation

Druue
Copy link
Contributor

@Druue Druue commented Jun 12, 2024

Currently, we can only actively log in language-tools on the typescript side. When it comes to rust engines, we're pretty blind outside of some panic info and knowing which endpoint we're calling:

console.log('running lint() from prisma-schema-wasm')

This PR adds the feature and hook for our previously unused dep wasm-logger. Which means we can now see logs (note: not using dbg!) from prisma-fmt in the extension debug environment.

Example:

pub(crate) fn run(schema: SchemaFileInput) -> String {
    let schema = match schema {
        SchemaFileInput::Single(file) => psl::validate(file.into()),
        SchemaFileInput::Multiple(files) => {
            log::debug!("{:?}", files);
            psl::validate_multi_file(&files)
        }
    };
    ...
running lint() from prisma-schema-wasm
%cDEBUG%c prisma-fmt/src/lint.rs:18%c [("file:///Users/soph/src/prisma_debug/prisma/schema.prisma", SourceFile { contents: Allocated("generator client ") })]

closes prisma/language-tools#1193

update script for usage w/ language-tools now uses said featuer
@Druue Druue added domain/schema PR: Improvement A PR that improves existing functionality labels Jun 12, 2024
@Druue Druue added this to the 5.16.0 milestone Jun 12, 2024
@Druue Druue self-assigned this Jun 12, 2024
@Druue Druue requested a review from a team as a code owner June 12, 2024 21:13
@Druue Druue requested review from jkomyno and removed request for a team June 12, 2024 21:13
Copy link
Contributor

github-actions bot commented Jun 12, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.043MiB 2.043MiB 0.000B
Postgres (gzip) 813.867KiB 813.866KiB 1.000B
Mysql 2.013MiB 2.013MiB 0.000B
Mysql (gzip) 800.252KiB 800.251KiB 1.000B
Sqlite 1.914MiB 1.914MiB 0.000B
Sqlite (gzip) 762.106KiB 762.104KiB 2.000B

Copy link

codspeed-hq bot commented Jun 12, 2024

CodSpeed Performance Report

Merging #4919 will not alter performance

Comparing tech/wasm-logger (f6b3a3b) with main (03f1367)

Summary

✅ 11 untouched benchmarks

@Druue Druue requested a review from SevInf June 12, 2024 21:25
@Druue Druue changed the title tech(fmt): add feature for wasm-logger tech(fmt): use wasm logging Jun 12, 2024
Copy link
Contributor

@Jolg42 Jolg42 left a comment

Choose a reason for hiding this comment

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

This is great!

@Druue Druue merged commit e9ac668 into main Jun 13, 2024
207 checks passed
@Druue Druue deleted the tech/wasm-logger branch June 13, 2024 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain/schema PR: Improvement A PR that improves existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make prisma-fmt logs to work with language server
2 participants