LogNGraph
=========
*A Python 3.12 package for easily drawing primitives and saving log files*
Functionality
=============
⚠️ You're entering WIP territory ⚠️
Logs
----
1. Create Logger instance:
.. code:: python
from logngraph.log import get_logger
from logngraph.log.levels import *
logger = get_logger(__name__, filename="my_log_file.txt", level=TRACE) # Look for everything
# By default, log level is INFO
get_logger parameters:
- name: Name of the module/logger
- filename: Filename of the log file
- level: Logging level
- file_level: Like level, but for file. If None, will be the same as level.
- file_colors: If True, will write colorful text to the log file. (Can not be colorful in some editors)
2. Then just log!
.. code:: python
logger.trace("When you need to know EVERY detail")
logger.debug("Diagnosing or troubleshooting an issue")
logger.info("Something has happened, e.g. started a server")
logger.warn("Something unexpected has happened,"
" but code will continue running")
logger.error("App hit an issue that prevents a certain "
"function from working, e.g. payment system is offline"
"but the program can still continue running")
logger.fatal("Something crucial has stopped working, e.g"
"lost connection to the main server, can't"
"continue running")
That's it!
You can also change the log level:
.. code:: python
from logngraph.log.levels import *
logger.set_level(WARNING)
logger.set_file_level(INFO)
Here's a hierarchy of log levels:
- TRACE - e.g. what packets client received from the server
- DEBUG - e.g. game server froze, and you need to see why
- INFO - e.g. someone said something in chat, and you saved it in logs
- WARNING - e.g. lost connection to the server temporarily
- ERROR - e.g. lost connection to the server completely (timeout, etc.)
- FATAL - e.g. client could not find models for the characters
- NONE - e.g. you don't want logs (disabled)
Write to file happens when one of the log methods is called
Graphics
--------
1. Create a Window instance:
.. code:: python
from logngraph.graph import Window
window = Window(title="Window title", width=800, height=800, resizable=True)
2. Draw primitives:
.. code:: python
window.fill("#000000") # fills whole window with color
window.rect((10, 10), (250, 50), color="#ff00ff") # from (10, 10) with width, height (250, 50)
window.circle((25, 20), 15) # at (25, 20) with radius 15
window.line((0, 0), (800, 900), color="#0000ff") # from (0, 0) to (800, 900)
window.polygon((750, 750), (800, 400), (35, 600), color="#ff0000")
# Also you can display text!
window.write(60, 150, text="Hello, World!", color="#ffffff", bg_color="#000000", antialias=True, size=32, font="Arial")
# And, you can rotate and translate!
window.translate(500, 100)
# Now (0, 0) is (500, 100) for new primitives you want to draw!
window.rotate(45) # degrees
# Now everything after this will be rotated 45 degrees!
3. And update the screen:
.. code:: python
window.update()
Don't forget to ``window.handle_events()``!
4. You can also save the screen:
.. code:: python
window.screenshot("screenshot.png")
That's all!
Installation
============
Use pip:
.. code:: bash
pip install logngraph
Raw data
{
"_id": null,
"home_page": null,
"name": "logngraph",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "log, logging, graphics, primitives, pygame",
"author": null,
"author_email": "Vadim Gladushev <vadim.gladushev@mail.ru>",
"download_url": "https://files.pythonhosted.org/packages/1f/45/d3bb4a51b725a42fb74ed03586347da4e20599aea68447175e0d2896bc0e/logngraph-0.0.19.tar.gz",
"platform": null,
"description": "LogNGraph\r\n=========\r\n\r\n*A Python 3.12 package for easily drawing primitives and saving log files*\r\n\r\nFunctionality\r\n=============\r\n\r\n\u26a0\ufe0f You're entering WIP territory \u26a0\ufe0f\r\n\r\nLogs\r\n----\r\n\r\n1. Create Logger instance:\r\n\r\n .. code:: python\r\n\r\n from logngraph.log import get_logger\r\n from logngraph.log.levels import *\r\n logger = get_logger(__name__, filename=\"my_log_file.txt\", level=TRACE) # Look for everything\r\n # By default, log level is INFO\r\n\r\n get_logger parameters:\r\n\r\n - name: Name of the module/logger\r\n - filename: Filename of the log file\r\n - level: Logging level\r\n - file_level: Like level, but for file. If None, will be the same as level.\r\n - file_colors: If True, will write colorful text to the log file. (Can not be colorful in some editors)\r\n\r\n2. Then just log!\r\n\r\n .. code:: python\r\n\r\n logger.trace(\"When you need to know EVERY detail\")\r\n logger.debug(\"Diagnosing or troubleshooting an issue\")\r\n logger.info(\"Something has happened, e.g. started a server\")\r\n logger.warn(\"Something unexpected has happened,\"\r\n \" but code will continue running\")\r\n logger.error(\"App hit an issue that prevents a certain \"\r\n \"function from working, e.g. payment system is offline\"\r\n \"but the program can still continue running\")\r\n logger.fatal(\"Something crucial has stopped working, e.g\"\r\n \"lost connection to the main server, can't\"\r\n \"continue running\")\r\n\r\nThat's it!\r\n\r\nYou can also change the log level:\r\n\r\n.. code:: python\r\n\r\n from logngraph.log.levels import *\r\n logger.set_level(WARNING)\r\n logger.set_file_level(INFO)\r\n\r\nHere's a hierarchy of log levels:\r\n\r\n- TRACE - e.g. what packets client received from the server\r\n- DEBUG - e.g. game server froze, and you need to see why\r\n- INFO - e.g. someone said something in chat, and you saved it in logs\r\n- WARNING - e.g. lost connection to the server temporarily\r\n- ERROR - e.g. lost connection to the server completely (timeout, etc.)\r\n- FATAL - e.g. client could not find models for the characters\r\n- NONE - e.g. you don't want logs (disabled)\r\n\r\nWrite to file happens when one of the log methods is called\r\n\r\nGraphics\r\n--------\r\n\r\n1. Create a Window instance:\r\n\r\n .. code:: python\r\n\r\n from logngraph.graph import Window\r\n window = Window(title=\"Window title\", width=800, height=800, resizable=True)\r\n\r\n2. Draw primitives:\r\n\r\n .. code:: python\r\n\r\n window.fill(\"#000000\") # fills whole window with color\r\n window.rect((10, 10), (250, 50), color=\"#ff00ff\") # from (10, 10) with width, height (250, 50)\r\n window.circle((25, 20), 15) # at (25, 20) with radius 15\r\n window.line((0, 0), (800, 900), color=\"#0000ff\") # from (0, 0) to (800, 900)\r\n window.polygon((750, 750), (800, 400), (35, 600), color=\"#ff0000\")\r\n # Also you can display text!\r\n window.write(60, 150, text=\"Hello, World!\", color=\"#ffffff\", bg_color=\"#000000\", antialias=True, size=32, font=\"Arial\")\r\n # And, you can rotate and translate!\r\n window.translate(500, 100)\r\n # Now (0, 0) is (500, 100) for new primitives you want to draw!\r\n window.rotate(45) # degrees\r\n # Now everything after this will be rotated 45 degrees!\r\n\r\n3. And update the screen:\r\n\r\n .. code:: python\r\n\r\n window.update()\r\n\r\n Don't forget to ``window.handle_events()``!\r\n\r\n4. You can also save the screen:\r\n\r\n .. code:: python\r\n\r\n window.screenshot(\"screenshot.png\")\r\n\r\nThat's all!\r\n\r\nInstallation\r\n============\r\n\r\nUse pip:\r\n\r\n.. code:: bash\r\n\r\n pip install logngraph\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Draw primitives and save your logs!",
"version": "0.0.19",
"project_urls": {
"Documetation": "https://logngraph.readthedocs.io/en/latest",
"Issues": "https://github.com/GS11566/logngraph/issues",
"Repository": "https://github.com/GS11566/logngraph.git"
},
"split_keywords": [
"log",
" logging",
" graphics",
" primitives",
" pygame"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "09874d7d7310385853326b58843b32218c4b6bfd7983390ea8e2537b9d83f2cf",
"md5": "c36c0bab95bacc6ea06ff80b8f3d28f0",
"sha256": "9911297f60a804c11e6225fdcaecce1bd0848b858657fb32324f17fd190362f0"
},
"downloads": -1,
"filename": "logngraph-0.0.19-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c36c0bab95bacc6ea06ff80b8f3d28f0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 10603,
"upload_time": "2025-09-04T16:59:47",
"upload_time_iso_8601": "2025-09-04T16:59:47.453213Z",
"url": "https://files.pythonhosted.org/packages/09/87/4d7d7310385853326b58843b32218c4b6bfd7983390ea8e2537b9d83f2cf/logngraph-0.0.19-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1f45d3bb4a51b725a42fb74ed03586347da4e20599aea68447175e0d2896bc0e",
"md5": "3f9105d2dd38887131dad06f6949733a",
"sha256": "3b086399432402fb3e62adca2529e5a36669e3413bff996561ee8a4a18bea71e"
},
"downloads": -1,
"filename": "logngraph-0.0.19.tar.gz",
"has_sig": false,
"md5_digest": "3f9105d2dd38887131dad06f6949733a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 11569,
"upload_time": "2025-09-04T16:59:49",
"upload_time_iso_8601": "2025-09-04T16:59:49.215083Z",
"url": "https://files.pythonhosted.org/packages/1f/45/d3bb4a51b725a42fb74ed03586347da4e20599aea68447175e0d2896bc0e/logngraph-0.0.19.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-04 16:59:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "GS11566",
"github_project": "logngraph",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "pygame",
"specs": []
},
{
"name": "sphinx-rtd-theme",
"specs": []
}
],
"lcname": "logngraph"
}