Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Feature logging #90

Merged
merged 7 commits into from Nov 18, 2017
Merged

Feature logging #90

merged 7 commits into from Nov 18, 2017

Conversation

metachris
Copy link
Contributor

@metachris metachris commented Nov 18, 2017

What current issue(s) does this address?, or what feature is it adding?

This is a big one. Basically replaced all print and __log statements with logger.info, and the internal NeoNode and a few other very verbose and often occuring ones with logger.debug. Just in neo.Prompt.* the original print statements were left, because they are often used for user interaction.

In prompy.py you can toggle:

  • debug logging from prompt with config debug on/off
  • smart contract events with config sc-events on/off

Note: if you set the disable debug logging with config debug off, this also effects the logfile, since we are configuring and using the same logger for console and file handler.

In Settings there is now: set_log_smart_contract_events(..), set_logfile(..) and set_loglevel(..) with the default loglevel set to logging.INFO initially.

I also tried to change all error output and exceptions to logger.error and logger.exception.

Lastly, I fixed an error that often occured for smart contracts here: https://github.com/CityOfZion/neo-python/compare/feature-events...metachris:feature-logging?expand=1#diff-af1e060838849446615e1242da849889R263

How did you solve this problem?

Lots of search and replace, and manual testing, and automatic testing.

How did you make sure your solution works?

The tests still work, and manual testing too.

Did you add any tests?

No

Did you check your pycodestyle?

Yes

Are there any special changes in the code that we should be aware of?

...

Any log statement that should always be presented to the user should use at least the INFO loglevel (eg. logger.info(...)). Pure debug output that the user has to first enable should use logger.debug(..).

Are you making a PR to a feature branch or development rather than master?

feature-events

…ging

* origin/feature-events:
  turn back on logging sc events by default
  catch error when trying to get script container
  Logging: configure through settings, enable logfile (#89)
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 67.684% when pulling 0ae0639 on metachris:feature-logging into e73e629 on CityOfZion:feature-events.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 67.704% when pulling 93e3938 on metachris:feature-logging into e73e629 on CityOfZion:feature-events.

@localhuman
Copy link
Collaborator

This is, as always, a great addition!

@localhuman localhuman merged commit d807d77 into CityOfZion:feature-events Nov 18, 2017
localhuman pushed a commit that referenced this pull request Nov 19, 2017
* events: first baby step

* event hub update and requirement fix

* feature-events: pycodestyle

* feature-events: Runtime.Nofify payload always list of string

* Runtime.Notify and Runtime.Log almost done

* eventhub: docs update, notify always get list

* start SmartContract dapp interface

* fix stackitem.GetInterface

* feature-events: EventHub and SmartContractEvent simplification

* notify event dispatching changes

* pep8 the changes

* pep8 the changes

* updating event dispatching

* checking for errors

* formatting

* added testmode into events

* changed how items are queried and deleted in DBCollection

* removing unnecessary try / excepts

* style fix

* added deletenep5 token

* style fix

* moved SmartContract to contrib/

* InvokeContract: return wallet_tx instead of True

* EventHub and SmartContract inline docs

* replaced print with log statements

* contrib/smartcontract: simplification, bugfix and docs

* Logging: configure through settings, enable logfile (#89)

* catch error when trying to get script container

* turn back on logging sc events by default

* Feature logging (#90)

* Logging: configure through settings, enable logfile

* Update all __log and print statements to new logger system

* move default log level to INFO, and only have certain (often-occuring) log messages in DEBUG

* Fixes

* UserWallet: logger.info -> logger.error + logger.debug

* UserWallet pep8 fix
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.

None yet

3 participants