Giter VIP home page Giter VIP logo

Comments (3)

DannyHinshaw avatar DannyHinshaw commented on August 15, 2024 1

Well I'm glad you pointed this out, apparently my logger has not been logging to my error.log file... damn. I'll be redacting my post before as a "solution", like you said, it really only suppresses the ts warnings, apparently it's still busted.

from coinbase-pro-trading-toolkit.

DannyHinshaw avatar DannyHinshaw commented on August 15, 2024

Sounds like your use case is more advanced than mine, in which case this probably won't be helpful for you... but for others that run into this new issue here has been my work around customizing the logger after this winston update:

this only suppresses the typescript warning. logger is still not working.

import * as winston from 'winston';
import * as GTT from 'gdax-trading-toolkit';
import {Logger} from 'gdax-trading-toolkit/build/src/utils';

// Application logger
export const logger: Logger = GTT.utils.ConsoleLoggerFactory({
	level: 'debug',
	colorize: true
});

// It's still possible to use 'transports', bracket notation suppresses ts warnings
logger['transports'] = [
	new winston.transports.Console({
		colorize: 'all',
		json: false,
		timestamp: true
	}),
	new winston.transports.File({filename: 'error.log', level: 'error'}),
	// new winston.transports.File({ filename: 'debug.log', level: 'debug' })
];

from coinbase-pro-trading-toolkit.

sfkiwi avatar sfkiwi commented on August 15, 2024

that's a neat trick for suppressing the typescript warnings and perhaps I'm misreading the updated code in ConsoleLoggerFactory but the logger instance from winston is hidden in a closure. So the object that is passed back is akin to:

function ConsoleLoggerFactory() {
  let logger = new winston.Logger()
  let returnedObj = {
     log: logger.log,
     error: logger.error
  }
  return returnedObj;
}

It's obviously not quite like this but just trying to illustrate that the winston logger instance is not actually available in the returned (gdax-tt)Logger instance.

So, to my understanding at least, you are attaching a new transport to the returned object, which would work if you were attaching it to the logger instance but I'm not sure how it would work attaching it to the returned Logger object. You would essentially end up with

{
   log: logger.log,
   error: logger.error,
   transports: winstonTransportInstance
}

from coinbase-pro-trading-toolkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.