Hey guys, I want to log my “class name”, but I get...
# sst
a
Hey guys, I want to log my “class name”, but I get some random generated name. For example:
Copy code
console.log(MyCoolClasss.name, 'start');
But we I get this in the logs:
Copy code
Ea start
I think it’s the bundler or something, but I don’t know which config does this.
l
Minimizer?
a
Yeah.
But how I can disable it?
l
Put
"minify": false
in sst.json
f
a
Thank you, going to check it.
t
I think this is actually a different issue, there's an esbuild
preserveNames
option
I don't think we expose it at the moment
a
keepNames
should do the trick - preserves the class
name
property for dependency injection, so would do so for simple logging as well.
Contextual example:
Copy code
/*
   * App-level configuration
   */
  app.setDefaultFunctionProps({
    runtime: "nodejs14.x",
    architecture: Architecture.ARM_64,
    logRetention: RetentionDays.ONE_MONTH,
    memorySize: 256,
    tracing: Tracing.DISABLED, // x-ray
    bundle: {
      esbuildConfig: {
        keepNames: true, // preserve for @sailplane/injector
        plugins: "./src/stacks/esbuild-plugins.js",
      },
    },
    environment: {
      NAMESPACE: app.logicalPrefixedName("").slice(0, -1),
      NODE_OPTIONS: "--enable-source-maps",
    },
  });
(v0.69 - don't know if v1.0 has changed any of that.)
t
oh we do expose it
a
Thank you very much guys, going to give it a try.
@Adam Fanello what do you use NAMESPACE for? in the environment? out of curiosity.
t
wrong adam!
a
Ups.
Sorry.
t
I use a similiar concept to namespace to know where to search for SSM values
a
Interesting.
For runtime SSM usage?
I send the keys on the env.
I mean, the keys that must be consumed in runtime.
a
Yep, mostly used for SSM.
t
LOL he initially tagged the "wrong adam"
I didn't mean you were wrong
omg now you edited your message too
you guys are making me look dumb
a
Yup, figure that must have been it and removed my question, but not before you answered it. Editing history gets confusing. 😄
a
Hahaha.
a
If only that worked in real life.