ExploreConsulting / netsuite-fasttrack-toolkit-ss2

NFT for SuiteScript 2.X
75 stars 20 forks source link

No logging in client script #88

Closed steveklett closed 9 months ago

steveklett commented 9 months ago

I'm sure I'm doing something wrong, but I'm not able to get any logging to work in a client script. No log entries are appearing in the browser console or the script execution log. I've reviewed EC_Logger.ts as well as aurelia.logging.d.ts and I'm not seeing the issue. LogManager.DefaultLogger.getLevel() returns 0 even what I set the level to 2 with LogManager.DefaultLogger.setLevel(2)

I'll gladly update the docs and example.ts content with a browser example if someone can help show me the light. :)

/**
 * @NApiVersion 2.1
 * @NScriptType clientscript
 **/

import { EntryPoints } from 'N/types'
import * as LogManager from '../NFT-SS2-7.2.0/EC_Logger'

namespace NV {
  const log = LogManager.DefaultLogger

  export function fieldChanged(context: EntryPoints.Client.fieldChangedContext) {
    log.setLevel(2)
    alert('set log level to 2 with setLevel()')
    log.debug('console log test')  //  Doesn't show up in browser or script execution logs
    alert(LogManager.getLevel())  //  Still reports 0
  }
}

export = {
  fieldChanged: NV.fieldChanged
}
ShawnTalbert commented 9 months ago

Hmmm, nothing's changed here that I know of in NFT. The default should be that messages go to the console, and I think default verbosity is DEBUG.

Will have to try and repro and get back to you.

On Mon, Feb 19, 2024 at 3:12 PM Steve Klett @.***> wrote:

I'm sure I'm doing something wrong, but I'm not able to get any logging to work in a client script. No log entries are appearing in the browser console or the script execution log. I've reviewed EC_Logger.ts as well as aurelia.logging.d.ts and I'm not seeing the issue. LogManager.DefaultLogger.getLevel() returns 0 even what I set the level to 2 with LogManager.DefaultLogger.setLevel(2)

I'll gladly update the docs and example.ts content with a browser example if someone can help show me the light. :)

/**

  • @NApiVersion 2.1
  • @NScriptType clientscript **/

import { EntryPoints } from 'N/types' import * as LogManager from '../NFT-SS2-7.2.0/EC_Logger'

namespace NV { const log = LogManager.DefaultLogger

export function fieldChanged(context: EntryPoints.Client.fieldChangedContext) { log.setLevel(2) alert('set log level to 2 with setLevel()') log.debug('console log test') // Doesn't show up in browser or script execution logs alert(LogManager.getLevel()) // Still reports 0 } }

export = { fieldChanged: NV.fieldChanged }

— Reply to this email directly, view it on GitHub https://github.com/ExploreConsulting/netsuite-fasttrack-toolkit-ss2/issues/88, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKFNA2XLMXILCOUU7JDWHTYUPL6HAVCNFSM6AAAAABDQFQBQ6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2DGMRXGA4DENY . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

steveklett commented 9 months ago

OK, I'm an idiot. I didn't realize the console had filtering enabled and was filtering out "verbose" level which is where debug level logs go. Sorry for the false alarm, hopefully this issue post will help someone else out some day :)

image