Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Squashed commit of logging improvements #5

Closed

Conversation

gnomesoftuk
Copy link

Please test this and let me know what you think Tony.

In essence what I have done is add more verbose logging and use a production grade logger called winston which allows more flexible logging than the default console logger.

You can add LOGBASEPATH=

to the .env file if you wish to put the logs somewhere else, in my case i've put LOGBASEPATH=/var/log/trades/ in and I have configured a datadog agent to listen to this directory and push it to datadog so I can track my trades without connecting to the server.

Note the path must have a tailing slash.

I just noticed the "reconnect:true" flag made it into this commit - feel free to dump it if you want I am using it without any troubles.

Feel free to change the logging wording if you'd like, I spent a bit of time getting them to look nice but I understand if you and Shannon have other preferences.

I'm happy to share the setup for datadog if you'd like but it sounds like you guys have a pretty decent setup already, I cant really log into servers at work as everything locked down but I can access websites over port 80 so datadog works for me (PS I don't work for these guys lol).

Roger Watkins added 2 commits November 4, 2018 13:45
…21496fad48fAuthor: Roger Watkins <[email protected]>Date: Sat Nov 3 00:38:41 2018 +0000 More tidying up of log messages. Fix logging responses. Log warning if STOP not filled.commit f2355e6c1fa8f6cc4a9c30e4901357aacaf29be7Author: Roger Watkins <[email protected]>Date: Thu Nov 1 23:58:14 2018 +0000 Add moment.js for timer support. Output price updates every 5 minutes.commit 5080b3efe0c7ada2607931da2172bae0d8b572f1Author: Roger Watkins <[email protected]>Date: Thu Nov 1 23:19:41 2018 +0000 Add winston logger to script and add some helpful logging to see what is going on, including order entries and cancellations.commit c402d6f491a3339132d36bf3a4dea5ccb47634abAuthor: Tony Ho <[email protected]>Date: Wed Oct 31 22:39:36 2018 +1100 Enable automatic reconnection of WebSockets
Fix trade update frequency after entry - now logs every 5 mins.
@gnomesoftuk gnomesoftuk force-pushed the add-better-logging-squashed branch from 125fa85 to 197a8c1 Compare November 7, 2018 22:48
@tony-ho tony-ho requested review from tony-ho and removed request for tony-ho November 19, 2018 11:19
@tony-ho
Copy link
Owner

tony-ho commented Jan 13, 2019

@gnomesoftuk Apologies for the (very) delayed response. Thanks for this pull request, it is much appreciated.

I don't think Winston logging is something I want to add at the moment.

Since binance-oco is a command line application, my preference is keep it logging to console and leave it up to the user to redirect output as they wish.

eg. users can use the tee command to redirect output/errors to both the console and file:

binance-oco [arguments...] 2>&1 | tee outputfile.txt

The following changes are good improvements and I would welcome these changes if separated from the Winston logging:

  • Timestamps on log messages
  • Formatting API responses using JSON.stringify()

The lastPriceUpdate is also a great addition but I feel it could be improved if the 5 minute time window was instead configurable via a command line option, with the default to retain existing behaviour and display every update.

I am going to close this but would be happy to see the above changes opened in a new pull request.

Thanks again for your contribution.

@tony-ho tony-ho closed this Jan 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants