1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-12 15:27:14 +03:00

82 Commits

Author SHA1 Message Date
David Sangrey
6139d66b8e
Merge branch 'develop' into enhancement/2114/pathlib-handover 2024-07-21 23:40:35 -04:00
David Sangrey
fcd7b8da0f
[2215] Clarify Config Imports 2024-06-17 18:20:53 -04:00
David Sangrey
f8b7a8b919
[2114] Cleanup Initial Commit
Some of these are already paths.
2024-06-10 17:49:13 -04:00
David Sangrey
fe8818d187
[2114] Apply PathLib Handover 2024-06-10 17:21:06 -04:00
David Sangrey
74af852fca
[2215] Move Logging Directory 2024-06-10 09:43:00 -04:00
David Sangrey
13e74f2c57
[2255] Replace Infi Systray with simplesystray 2024-06-09 15:28:27 -04:00
Bruno Marques
192ba5f8f2 Adding pkg_resources exception to DeprecationWarning 2024-06-09 20:07:13 +01:00
Bruno Marques
b0e682f66c Enabled DeprecationWarning by default and fixed references 2024-06-09 18:40:03 +01:00
David Sangrey
95c73179c6
[2051] Logging File Check 2023-11-17 18:39:47 -05:00
Athanasius
f4b150960c
prefs.py & related files: Fix up mypy type checking
* Some trivial.
* As myNotebook.py's class is based on `ttk.Notebook`, typing changed to
  that.
2022-12-23 14:47:21 +00:00
Athanasius
acbe1231ef
EDMCLogging: loglevel is str | int 2022-12-23 14:47:03 +00:00
Athanasius
333b84ada6
EDMCLogging: Fix minor MAGIC comment format issue 2022-01-20 14:59:46 +00:00
Athanasius
251f129774
EDMCLogging: Reword/format the 'UTC please' MAGIC comments 2022-01-20 14:58:06 +00:00
A_D
71261fc3d9
Reorder and clarify some comments 2022-01-20 16:49:38 +02:00
A_D
3b4f6a4e85
switch comments to MAGIC tags 2022-01-20 16:41:18 +02:00
A_D
5f007b3f77
more clarifying logs 2022-01-20 16:32:36 +02:00
A_D
66a212f7c4
move UTC to hardcoded, add comment 2022-01-20 16:26:04 +02:00
A_D
85f7bddef0
use gmtime as time formatter 2022-01-20 15:52:44 +02:00
Athanasius
82ab72a655
EDMCLogging: Fix import order 2021-08-13 15:22:35 +01:00
A_D
504e7c7eb5
use glob matching for trace-on matching 2021-08-13 15:50:36 +02:00
A_D
41895d591a
added trace-if and TRACE_ALL loglevels 2021-08-12 16:45:18 +02:00
Athanasius
4db6542269 EDMCLogging: No fn.__qualname__ ? Just use name. 2021-05-10 15:22:56 +01:00
A_D
71f2246cf4
Missed an import 2021-05-10 15:34:02 +02:00
A_D
5fea307fd7
Fixed quotes 2021-05-10 15:30:47 +02:00
A_D
92e580e0c7
Fixed error when logging out of a class var
This also adds an insane amount of paranoia around getting SOMETHING
dumped when an exception happens.

Fixes #1044
2021-05-10 15:28:26 +02:00
Athanasius
bc33bf1b19 Attempt to get develop back to code state before rebase on main. 2021-04-01 14:45:51 +01:00
Athanasius
a6866fb4d1 EDMCLogging: Return 'best efforts' if erroring in caller_attributes() 2021-04-01 14:45:50 +01:00
Athanasius
d589ca6ed2 Expand caller_attributes() docstring to params and return 2021-04-01 14:45:50 +01:00
A_D
051245cf90 Renamed various config values to be backwards compatible 2021-04-01 14:45:48 +01:00
Athanasius
92d9185b43 EDMCLogging: Revert to Python 3.8+ walrus operator
* Re-order an import to make isort happy
* Mark caller_attributes() as ignoring C901 as well

# Conflicts:
#	EDMCLogging.py
2021-04-01 14:45:47 +01:00
A_D
374d96e767 Fixed unquoted LoggerMixin cast 2021-04-01 14:45:46 +01:00
Athanasius
25852997c5 Updated all source to use new config methods
# Conflicts:
#	monitor.py
2021-04-01 14:45:46 +01:00
Athanasius
4c9cf9ed65 Logging: Add osthreadid, and add process, thread and osthreadid to format
* It looks like in Python 3.8 the %(thread)d is the native OS thread ID
  anyway, but let's keep osthreadid anyway.
2021-04-01 14:45:44 +01:00
A_D
ddb53a6ca1 Added type checker magic to make TRACE work
Relatively simple. Because all of our loggers are created out of
EDMCLogging, we can create a fake type in EDMCLogging that inherits
from logging.Logger but also defines a trace method.

Once that is done, we just have to annotate our methods to get loggers
with the new type, cast all of the returns, and suddenly we no longer
have any complaints about logger.trace. This doesn't _actually_ change
any behaviour at runtime, and logging.Logger.trace and logging.TRACE
will continue to be broken, but those are used far less than
logger.trace is used throughout the codebase, and therefore I think we
can live with `# type: ignore` comments everywhere
2021-04-01 14:45:44 +01:00
Ash Holland
590cd608d3 Fix logging from mangled methods where class name starts with "_"
Python's name-mangling rules are quite complex. Previously, EDMC was
incorrectly mangling names where the class name starts with one or more
underscores; if the class name starts with any underscores, they should
be removed before prepending to the identifier being mangled. If the
class name contains *only* underscores, no mangling should be performed.
2021-01-08 15:32:42 +00:00
Athanasius
91e6583326
Merge pull request #812 from A-UNDERSCORE-D/fix/808-log-in-property-func
Added support for logging from properties
2021-01-05 14:27:59 +00:00
A_D
1cb876c594
Added support for logging from properties
This is some best effort support for using logging in properties.

This works by using the (as suggested by reporter) inspect
`getattr_static` method, and failing that (as it can possibly fail),
wrapping a `getattr` in a try/catch for a RecursionError--don't want to
catch other things, probably best if that explodes on its own.

From there as the `property` object will not have location information,
we rebuild as best we can to an approximation of what the path would be.
With a healthy dash of defensive programming "Just in case".

I don't think that this will have any adverse effects to other logging
methods, as all the new code should only be touched if we hit a property
object.

Closes #808
2020-12-21 12:39:45 +02:00
Athanasius
286647869b EDMCLogging: Comment out a 'testing' raise() call 2020-12-15 19:35:51 +00:00
Athanasius
f885c2b769 EDMCLogging: Catch inspect.getframeinfo(frame) not working
Maybe with this we'll see something 'here' or later to give a clue as to
why this doesn't work on at least two systems.
2020-12-15 15:08:36 +00:00
Athanasius
3ff9bdcc88 Fix Python 3.8 syntax use in backport to 4.1.x/Python 3.7 2020-12-08 16:08:30 +00:00
A_D
d650db5a1a Added name mangling support to EDMCContextFilter
Python name mangling is more about name collisions than actually making
things private.

This commit adds a check to resolve mangled names to their runtime
names, and adds a just-in-case default to fetching the attribute.

Fixes #764
2020-12-08 15:59:40 +00:00
Athanasius
969773b169 Debug log file name now EDMarketConnector-debug..log 2020-09-29 13:22:15 +01:00
Athanasius
9789c6fe7d Logging: Explicitly mention that we add trace/TRACE at runtime. 2020-09-28 11:18:25 +01:00
Athanasius
9e6e718e23 Logging: Document trace/TRACE workaround & expand other docs. 2020-09-28 11:02:13 +01:00
Athanasius
3c0ac76f90 Trace: Add support to EDMC.py & misc cleanups
* EDMC: Add --trace (to match EDMarketConnector.py) and TRACE as option to
  --loglevel.
* EDMC: docstrings added.
* EDMCLogging: Set logger name based on if GUI or CLI.
* EDMarketConnector:
  * Re-order imports.
  * Misc. formatting cleanups.
  * f-strings not .format().
  * Removed un-necessary "# noqa: N806" comments.
2020-09-23 17:38:38 +01:00
Athanasius
46e3b3aff8 Implement a TRACE level of logging.
For things that are too spammy for DEBUG, but we might need them
sometimes.
2020-09-23 15:58:19 +01:00
Athanasius
7750bbdf4a Move GUI/CLI conditional into get_plugin_logger()
It's cleaner here than in the calling plug.py code.
2020-09-22 16:09:39 +01:00
Athanasius
c0b01f88ac Add get_main_logger() method to EDMCLogging.py
This is so the decision on appname versus appcmdname is in one place.
2020-09-22 15:35:42 +01:00
Athanasius
ed8403f303 Plugin logging needs to be DEBUG, to let channels decide later.
This should have been changed when the rotating file logging was
implemented.
2020-09-18 12:17:08 +01:00
Athanasius
09add21a1a Logging: DEBUG always to rotated files, configured level to stdout/err
* EDMCLogging.Logger.get_streamhandler() method to get the
  logger_channel so prefs.py can call setLevel() on it.
* The top-level Logger level is always DEBUG.
* The RotatingFileHandler level is always DEBUG.
* The StreamHandler level is as configured by the user.
* EDMCLogging now creates a singleton of EDMCLogging.Logger and its
  associated Logger.
* plug.py tweaked to only import EDMCLogging where it's needed for
  getting/creating plugin loggers, else `import logging`.
2020-09-08 10:03:16 +01:00