1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-23 20:30:30 +03:00

1767 Commits

Author SHA1 Message Date
Athanasius
2e58d106bd logging.getLogger(appname) instead of import from EDMarketConnector
Using:

from EDMarketConnector import logger

causes issues if EDMarketConnector is already importing 'this' file.

So just get a logger using logger.getLogger(appname) instead.
`from config import appname` if needs be.
2020-07-27 06:57:52 +01:00
Athanasius
bae2f25e19 companion.py: Convert to proper logging 2020-07-27 06:57:52 +01:00
Athanasius
2176187be7 Fix typos in class/qualname finders 2020-07-27 06:57:52 +01:00
Athanasius
8e1f3b8a90 plugins/inara: Fix typo on except: 2020-07-27 06:57:52 +01:00
Athanasius
7d060aa325 plugins/inara: Convert to proper logging 2020-07-27 06:57:52 +01:00
Athanasius
4d7f81cec1 Add emergency print()s if we can't find class/qualname 2020-07-27 06:57:52 +01:00
Athanasius
89cadbc0eb Add paranoia checks to class and qualname finders 2020-07-27 06:57:52 +01:00
Athanasius
7951463fba plugins/edsm: Converted to proper logging 2020-07-27 06:57:52 +01:00
Athanasius
6aa409388e plugins/eddn: Converted to proper logging 2020-07-27 06:57:52 +01:00
Athanasius
818bd89fd7 Remove un-necessary {__class__} from logging messages 2020-07-27 06:57:52 +01:00
Athanasius
5af87a5b98 Clean up EDMarketConnector.py after that qualname testing 2020-07-27 06:57:52 +01:00
Athanasius
6b9d4a11cb Use a logging.Filter to implement %(qualname)s in formatting.
This gets the function that called the logging, and if it's in a class
it looks up the function via getattr(<class>, <func name>) and then
uses __qualname__ to quickly get the fully qualified name.
2020-07-27 06:57:52 +01:00
Athanasius
debc7f97d3 Use a logging.Filter to implement %(class)s in formatting. 2020-07-27 06:57:52 +01:00
Athanasius
2e12513c6c Changes plug.py to proper logging.
This relies on the logger.Formatter setup to fill in function name
rather than calling out exactly why we're logging.  It should be
obvious, i.e. if you're in plug.py:notify_journal_entry then the named
plugin threw an un-caught exception trying to call its method for this.
2020-07-27 06:57:52 +01:00
Athanasius
23b167fe66 Change startup version back to a print()
This is so early it doesn't need to be a spammy log message.
2020-07-27 06:57:27 +01:00
Athanasius
fe0ff2498e Moves logger definition so it's import'able 2020-07-27 06:57:23 +01:00
Athanasius
fa1443b49c Contributing.md: Document use of logging.
Also fixes some camelCase to be proper snake_case in an example.
2020-07-27 06:57:23 +01:00
Athanasius
c971106c0e Convert print()s to logging & refactor help_about -> HelpAbout 2020-07-27 06:57:23 +01:00
Athanasius
cd4216d19c logger setup and initialisation
* Initial printing of version is now a logger.info(...)
2020-07-26 23:16:52 +01:00
Athanasius
e1752506c5 Move "only run once" code into def enforce_single_instance() 2020-07-26 23:16:52 +01:00
A_D
5aaf88b281 fix quoting style 2020-07-26 23:08:47 +01:00
A_D
87b7f639bb cleanup coriolis.py 2020-07-26 23:08:47 +01:00
A_D
f08d60d9b1 revert using json.dump
windows encodings dont like the weird characters
2020-07-26 23:08:47 +01:00
A_D
0e0c802b04 Fixed missed whitespace after scope changes 2020-07-26 23:08:47 +01:00
A_D
64b9cb39a9 Replaced file.write(json.dumps()) with json.dump
There's no reason to use json.dumps and directly encode it when we can
let the json lib do the heavy lifting
2020-07-26 23:08:47 +01:00
A_D
566f52e61f removed uneeded parens 2020-07-26 23:08:47 +01:00
A_D
14295ce9e8 Fixed scope whitespace and long lines 2020-07-26 23:08:47 +01:00
A_D
8b0f3e74cf Replaced format directives with fstrings 2020-07-26 23:08:47 +01:00
A_D
c6d8b4eab8 Renamed variable for clarity 2020-07-26 23:08:47 +01:00
A_D
0e000de90a Replaced type annotation with Optional
The return is Optional so the annotation on the other side must be as
well, lest we have large red squiggles
2020-07-26 23:08:47 +01:00
A_D
3dfca91e1d Fixed invalid deep_get call 2020-07-26 23:08:47 +01:00
A_D
b6482878f0 Fix deep_get not returning the correct on success
I forgot to actually return the given data if we manage to index to the
requested depth
2020-07-26 23:08:47 +01:00
A_D
2403ed1d2f Replaced missed .get chains with deep_get 2020-07-26 23:08:47 +01:00
A_D
4ee8869426 Revert part of e510b783
Apparently config.get does _not_ take a default param. It really should.
2020-07-26 23:08:47 +01:00
A_D
664605a315 Cleaned up ifs where possible
Removed redundant or unneeded parens, correctly added line breaks where
needed
2020-07-26 23:08:47 +01:00
A_D
1ed9225c44 Added main guard
Modules should _always_ check that they are main before doing any "real"
work
2020-07-26 23:08:47 +01:00
A_D
637f58bb06 Replaced modulo-formatting with .format 2020-07-26 23:08:47 +01:00
A_D
0dfad42de3 Replaced .get chains with a new method
`deep_get` will go down a list of keys on a dict to find either the
requested key or the default if somewhere along the line the given dict
doesn't have a given key
2020-07-26 23:08:47 +01:00
A_D
8117e18963 Don't recompile regexps where possible
While the python re lib _does_ cache compiled regexps, it only does this
to a point, it's better to compile once and hold a reference
2020-07-26 23:08:47 +01:00
A_D
37c01c028c Replaced list comprehension with generator
Creating a list here doesnt make sense when its almost instantly
recreated.
2020-07-26 23:08:47 +01:00
A_D
31c049deda Replace sys.stderr.write call with print
`print()` supports files other than stdout, and will automatically add
newlines for us, among other things
2020-07-26 23:08:47 +01:00
A_D
f9b860fd5c removed bare except clause 2020-07-26 23:08:47 +01:00
A_D
9d727aaa99 Remove unused variables in as e clauses 2020-07-26 23:08:47 +01:00
A_D
2592af8c9f block flake8 line length on doc line 2020-07-26 23:08:47 +01:00
A_D
2e21960568 add newlines on scope changes 2020-07-26 23:08:47 +01:00
A_D
1f1e34d722 ensure that comments have two spaces before
most of the files have tabs between code and comments
2020-07-26 23:08:47 +01:00
A_D
c6e61cc3da Fix ~ not being expanded on linux 2020-07-26 23:08:47 +01:00
A_D
d67dd17367 ignore editor and virtual enviroment directories
Just to ensure that they're not reported by any local tools
2020-07-26 23:08:47 +01:00
A_D
179e06d6e9 added informational comment on private access 2020-07-26 23:08:47 +01:00
A_D
ecfed2b558 Modified dict comprehension to be more clear 2020-07-26 23:08:47 +01:00