Commit Graph

51 Commits

Author SHA1 Message Date
8e6613412b
Updated _logger.py
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.
2023-07-29 21:15:23 +01:00
a03342d81c
Updated common.py
Changed value name from 'NORMAL' to 'INFO'.
2023-07-29 21:15:06 +01:00
3083aa9b93
Amended module exports 2023-07-29 21:13:44 +01:00
0ad7b552b2
Update pyproject.toml 2023-07-29 21:07:39 +01:00
9f5f12a978
Updated pyproject.toml 2023-07-06 20:44:32 +01:00
c0e9c91206
Updated README.md 2023-07-06 20:44:17 +01:00
0062006199
Updates testing files 2023-07-06 20:36:50 +01:00
3615d2a03b
Removed tox.ini
Contents now in pyproject.toml
2023-07-06 20:36:18 +01:00
94fd027d6f
Removed requirements-dev.txt 2023-07-06 20:35:08 +01:00
f4bf4f96b6
Updated pyproject.toml
File is now fully compliant to build project with hatchling.
Replaces: setup.py, setup.cfg, any config files have been translated to
toml format.
2023-07-06 20:31:19 +01:00
bccd6155fb
Moved clog => src/clog
Change is to be compliant with pyproject.toml and hatchling
2023-07-06 20:14:39 +01:00
1a4a8c488d
Added py.typed 2023-07-06 20:14:37 +01:00
dd565ff035
Updated .gitignore 2023-07-06 20:12:04 +01:00
da46bb2cf5
Removed setup files
Using pyproject.toml
2023-07-06 16:57:23 +01:00
662ebe5e56
Update 'README.md'
Appended section for testing, and where to locate the testing documentation.

Signed-off-by: Ethan Smith-Coss <ethan.sc@closedless.xyz>
2022-05-16 17:35:58 +01:00
8b8e1dbe68
Merge branch 'main' of closedless.xyz:ClosedLess/clog 2022-05-16 17:23:55 +01:00
2339aabeb1
Added documentation TESTING.md
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.
2022-05-16 17:17:07 +01:00
4334be6cb7
Update 'README.md'
Added logo to README file

Signed-off-by: Ethan Smith-Coss <ethan.sc@closedless.xyz>
2022-05-13 16:14:41 +01:00
18591d6dbf
Added logos to assets
Added first design for clog logo icon badges.

Signed-off-by: Ethan Smith-Coss <ethan.sc@closedless.xyz>
2022-05-13 16:12:36 +01:00
1fb1a69dc4
Update 'LICENCE.txt'
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>
2022-05-12 23:04:42 +01:00
8ca27b5f81
Updated README.md
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.
2022-05-12 19:14:23 +01:00
f22e6ea554
Updated _logger.py
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.
2022-05-12 14:03:28 +01:00
61c3411faf
Updated utils/common.py
Fixed bug with regex to allow for pathspecs containing a period (.)
character, and amended statement to flake8 W504 definition.
2022-05-12 14:01:06 +01:00
e4446c90ec
Added pytest testing module
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.
2022-05-12 13:49:32 +01:00
32d84b5808
Added .coveragerc
Added configuration file for pytest-cov
2022-05-12 13:48:52 +01:00
6cd0024113
Added conftest.py for pytest
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.
2022-05-12 13:46:11 +01:00
693f516f58
Updated .gitignore
Added ignore for .coverage file (not readable, .coveragerc is correct
file)
2022-05-12 13:45:07 +01:00
b108e21296
Updated setup.cfg
Added ignore for W503 (this is best practice, not W504)
2022-05-12 13:43:55 +01:00
8ef1891ca6
Amended files to adhere to flake8 and mypy
Files changed in accordance with flake8 and mypy reports and defined
sections which should be ignored by the systems.
2022-05-04 21:26:51 +01:00
38ce833bb1
Updated automation build scripts
Added dependencies for testenv with tox using requirement-dev.txt
Fixed typo bug for `options.extras_require`
Satisfied setup.py for flake8 and mypy
2022-05-04 21:24:47 +01:00
17109872cb
Updated pyproject.toml
Using setuptools>=45.0 due to version limitations with Py3.6
2022-05-04 21:24:28 +01:00
d80b949e26
Removed .coverage file
File accidentally added in assumption for .coveragec file
2022-05-04 21:23:10 +01:00
3fe521bcf5
Updated files to flake8 standard
Files have been changed to ensure they abid flake8 defined rules that
have not been identified as ignored. Files mostly pass flake8 rules.
2022-05-04 01:13:13 +01:00
c0eff133a9
Updated setup files
Updated flake8 settings in config files
2022-05-04 01:12:14 +01:00
a87c6b1998
Added requirements-dev.txt
File is used with pip to install all the required dependencies for developer testing only
2022-05-04 00:18:43 +01:00
1c81c304d3
Updated setup.cfg
Added entries for testing and flake8
2022-05-04 00:17:52 +01:00
419586f326
Updated pyproject.toml
Added configuration for pytest and mypy
2022-05-04 00:17:09 +01:00
c712c1b819
Added .coverage
Coverage file for pytest[-cov]
2022-05-04 00:16:04 +01:00
9ea22d95ea
Updated .gitignore 2022-05-04 00:14:53 +01:00
8eccf1907d
Added tox.ini
File to perform integration testing on different version of Python that ensure Python runs on all defined versions
2022-05-03 23:40:19 +01:00
8302e750df
Added README.md
TODO: complete README.md
2022-05-03 23:36:13 +01:00
cd2e477430
Added packaging build files
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.
2022-05-03 23:32:53 +01:00
5da9e7990e
Moved package modules into clog
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.
2022-05-03 23:28:44 +01:00
19fb760fa9
Updated .gitignore 2022-05-03 23:20:28 +01:00
d1b06d3d44
Udpated utils/common.py
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.
2022-05-03 18:18:52 +01:00
ea99138469
Updated utils/printfmt.py
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.
2022-05-03 18:16:54 +01:00
6ddb43d194
Updated _logger.py
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.
2022-05-03 18:13:18 +01:00
a0e487a2a7
Updated main.py
Added another example of how to log with pseudologs
2022-05-03 18:12:59 +01:00
5e922c5515
Added clog package modules
This commit is a continuation from commit [3746b773f4] which is a
separation of library modules into its own package from a larger
project.

Version control jump is significant in feature implementations due
simply to under-using commit control after minor feature
implementations. Project will receive better commit messages going
forward on changes to the package.
2022-05-03 14:51:57 +01:00
b91572874e
Added LICENCE.txt
Added the GNU GPLv3+ licence agreement
2022-05-03 14:51:54 +01:00