Major changes to the structure behaviour when logging.
- Class no longer implements pseudologs as class methods. These are now
instance methods but return the class instance to allow for method
chaining.
- `class@Logger` is no longer a singleton pattern. Class may now either
return a new logger instance, or return an existing logger if matched.
A user may recreate an existing logger using the `Logger@new()` method
instance.
- An existing logger may be returned either by creating a new logger
with the same `name=` attribute, or by using the `Logger@get()` static
method and passing the name of an existing logger.
- A context manager, `class@LoggerStore`, has been implemented. This is to
allow for multiple loggers to be created and kept track of during the
lifetime of a program. This class is fully static and only accessed by
internal processes.
- The `Logger@printLog2File` method has been renamed to `writeLog()`. In
the case a user wishes to write to console, `Logger@printLog` may be
used. Note, pseudolog methods still print to log as default behaviour.
- Other changes to class methods to be appropriate for the amended
changes outlined above.
- Bug fixes.
Added new documentation regarding the process of conducting new unit
tests for the project. Documentation covers what libraries are used in
test-driven development, along with how they are used.
Documentation covers how to create new unit tests according to a defined
standard, as well as using pytest fixtures.
Fixed issue whereby licence file was automatically downloaded but corrupt.
Full licence agreement is now visible.
Signed-off-by: Ethan Smith-Coss <ethan.sc@closedless.xyz>
Completed a README file containing a description of what the project is
and how it works. Along with examples on how to use the library, reasons
to use the project, and how it compares to built-in libraries.
Changed module in accordance to results of pytest unit testing.
`__DEFAULT_OUT_FILE` now converts a file spec into a real pathspec to
the system. This is now considered a constant default attribute.
New attribute `__default_out_file` to take the value of
`__DEFAULT_OUT_FILE` on initial class initialisation. However, this
attribute may be changed on a new class construction, and is used by the
class itself as the default output to file when logging.
Attribute `log` is reflective of `__default_out_file` and CANNOT be
changed by the user to affect class instance, making it Read-Only.
Added new public method `new`, which can reinitialise the
Singleton instance to change the default logging file. Note, once an
instance is created, the output file cannot be changed unless `new` is
invoked with a new file pathspec. This is to guarantee integrity of
logging output to a single file, unless otherwise required.
Class modifications to address changes listed above and bug fixes
identified from unit testing.
Added files which hold unit tests for each package component
respectfully. Unit testing makes use of the pytest library.
Majority of tests are self-explanatory, with wordy function headers to
help understand the purpose of the test. Note, test modules DO NOT
provide best practices and are separate from the standards set for the
remaining code base. For this reason, mypy and flake8 are told to ignore
testing modules.
pytest-cov is used to gain an idea of how much of the code base is being
reached by the unit tests. Coverage does not have to be 100%, and 100%
coverage does not indicate "bug-free" code. If any bugs are identified,
or further unit tests are possible to increase code base coverage,
create a new Issue, or PR request with the appropriate changes.
File contains a fixture which must be present for test_logger module to
work functionally. Fixture relates to a monkeypatch implementation for
capturing standard PIPEs and storing their results in a buffer. This
buffer can then be read after a call to send data on a PIPE stream has
been called, via a key lookup on the appropriate stream.
The committed files define the requirements and information related to
clog when packaging the module into a library.
setup.py instantiates the build script process used by pip in editor
mode, with the support of setup.cfg. File uses traditional build
approach using the setuptools library.
All files related to the clog package have been moved into the directory
space "clog/" to separate project repository from package itself, and
allows for the building of the package tool via pip.
Added a __version__.py file to contain all important attributes about
the package.
Added docstrings to module functions and classes, explaining purpose and
function of the function/class. Outline the parameters and return types.
`is_path_spec` renamed to use snake_case. Constants also made globally
to the module.
Module given docstrings to explain the purpose and function of defined
module functions. Giving parameter and return values of functions.
Module now contains `gen_log_header` moved from the `Logger` class,
along with global constants for the function.
Module given docstrings to extensively explain the purpose and function
of defined methods within the class, and class structure itself.
Method `genLogHeader` has been moved to `printfmt` module and renamed
`gen_log_header`, along with appropriate private attributes now global
constants in the module.