Commit Graph

6 Commits

Author SHA1 Message Date
T. Joseph Carter
894225d1fa Use LOG, move logging setup to cppo
The actual logging configuration belongs in the application, not a module.  In a
module, it's always going to do what the module says to do.  And that's fine for
cppo which is a script that works the way it does, but we have bigger plans for
this code.  It's now in the cppo module.

We've stopped using log from blocksfree.logging, favoring LOG instead, so we
have removed it.
2017-07-18 18:19:57 -07:00
T. Joseph Carter
8212c2f848 Mostly style improvements to logging.py
Our changes to the built-in logging module of Python are kind of a hack designed
to be as lightweight as possible way to replace the built-in logging module with
one that operates using newer str.format based string expansion.  It's not
really complete we probably should change that at some point.

Changes include:

 - Docstrings, lots of docstrings
 - Type hinting
 - log is now LOG
 - pylint warnings disabled on things that will not change and are on purpose
 - StyleAdapter.log does not dedent msg anymore unless dedent=True is passed
   which hopefully should make it a little less DWIM.
2017-07-18 09:28:48 -07:00
T. Joseph Carter
3f90743d56 Add license, Copyright notices, history doc
The history document is kind of a mishmash of explanation about what decisions
have lead to what this project is trying to do and why this rather than other
things, such as improving AppleCommander.  (Ohh, it has the reason for that
believe me--die in the cash-consuming fire of the Internet's rage, Oracle!)

More importantly, there are Copyright notices and the GNU GPL v2.
2017-07-07 06:29:19 -07:00
T. Joseph Carter
d5bbc4aed3 We don't need the [LOGLEVEL], so skip it. 2017-07-07 02:40:12 -07:00
T. Joseph Carter
d4d9cc8072 Use textwrap to dedent multi-line strings
This is kind of an expensive thing to do unconditionally, but it lets us make
multi-line strings fit into the code with less ugliness.  Basically, if you're
four levels in, you can do something like this:

                log.warn("""\
                There was a problem.
                It was probably wasn't fatal because this
                is only a warning, but it is enough to have
                a multiline string.
                """)

This will print without the indentation.  It's not quite as clean as how
docutils handles docstrings (allowing the first line to be unindented, hence
the line-continuation), but it's still an improvement.  If you can improve upon
this, please feel free to PR it!
2017-07-07 02:32:20 -07:00
T. Joseph Carter
82d851e39a Create blocksfree package for logger
The section of cppo containing the logging code has been moved to its own very
short module inside a (bare) Python package.  This is messily done for now, but
I wanted this to be a minimal commit.
2017-07-07 02:21:42 -07:00