loggerjava


Nameloggerjava JSON
Version 0.8.0 PyPI version JSON
download
home_pageNone
Summaryan easy logger outputs like java logs
upload_time2024-04-12 15:23:48
maintainerNone
docs_urlNone
authorHTony03
requires_python>=3.8
licenseNone
keywords python logger java_like
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # loggerjava

---
an easy logger outputs like java logs
### How to use
```python
import loggerjava
logger = loggerjava
logger.info("test")
logger.warn("test",pos="insidecommand")
logger.log("test",type="w",pos="main_test",showinconsole=False)
```

### Outputs
```commandline
[20:39:00] [main/debug]: test
[20:39:00] [main/info]: test
[20:39:00] [main/WARNING]: test
[20:39:00] [main/ERROR]: test
[20:39:00] [main/FATAL]: test
```

### Developing features
- [ ] mutiple variable with different configs
- [x] new config format
- [ ] catch and format errors
- [X] override config once


### Config
```python
import loggerjava
loggerjava.config(**kwargs)
"""
:param kwargs:input config names and config data
format: config_name = config_data

below are config_name and the description

name : change the name of the log file, only actives when abolutepath config is off

fileextension : change the extension of the log file, only actives when abolutepath config is off

absolutepath : change whether inputing the absolute path of the log file,
True for using the name and fileextension to create file in the program running location
False for using the route to create file in the specific location(note:you need to enter the file format,like:test.log)

route : change the file location, only activates when abolutepath config is on
the route should contain the

file_encoding : change the file encoding method

showdetailedtime : whether to show detailed time in the log file

showinconsole : whether to show the log in the python console

fatalexit : whether to exit the program after a fatal log

:return: none
"""
```
using `logger.exportconfig()` to export your current config

and using `logger.inportconfig(inputconfig)` to inport your config

### Exception handler
using the `loggerjava.exceptionhandler.exception(exc)` function to process an Exception

remember to register the defs/classes after you created them

```python
import loggerjava
import loggerjava.exceptionhandler
def test1(a):
    print(b)
class test2():
    def printa(self):
        print(self.b)
loggerjava.exceptionhandler.register_def(test1)
loggerjava.exceptionhandler.register_def(test2)
if __name__ == "__main__":
    try:
        test1(1)
    except Exception as E:
        loggerjava.error(loggerjava.exceptionhandler.handler(E))
    try:
        a = test2
        a.printa()
    except Exception as E:
        loggerjava.error(loggerjava.exceptionhandler.handler(E))
```
#### Output:
```commandline
[20:39:00] [main/ERROR]: NameError: name 'b' is not defined
    at <module> (test.py:30)
    at test1.test1 (test.py:21)

[20:39:00] [main/ERROR]: AttributeError: 'test2' object has no attribute 'b'
    at <module> (test.py:35)
    at test2.printa (test.py:25)
```
### Versions

`v0.8.0` added the exceptionhandler and clearcurrentlog function

`v0.7.6` change filetype -> fileextension, simplified the code, completed the override funciton

`v0.7.5.dev1` follow SemVer, no actual updates

`v0.0.7.5` edited the original log codes,adding "log" feature,add the fatalexit config

`v0.0.7.2` adding the "fatalexit" feature,adding an easier log function(not completed)

`v0.0.7.1` adding debug config,adding debug

`v0.0.7` no actual updates, updating version num to ver x.x.x

`0.0.6.1` update readme

`0.0.6` change the config method, adding file_encoding,absolutepath,filetype config

`0.0.5.1` rename outputconfig -> exportconfig

`0.0.5` added the outputconfig and the loadconfig function,edited the config part to let it output log

`0.0.4` upgrade the config sys and add helps

`0.0.3` upload the descriptions

`0.0.2` initial upload

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "loggerjava",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "python, logger, java_like",
    "author": "HTony03",
    "author_email": "HTony03 <HTony03@foxmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a7/0c/ce181ef053e5cb75907fa79ffbb6bcd2752a4db80478d944de01c6c3994f/loggerjava-0.8.0.tar.gz",
    "platform": null,
    "description": "# loggerjava\n\n---\nan easy logger outputs like java logs\n### How to use\n```python\nimport loggerjava\nlogger = loggerjava\nlogger.info(\"test\")\nlogger.warn(\"test\",pos=\"insidecommand\")\nlogger.log(\"test\",type=\"w\",pos=\"main_test\",showinconsole=False)\n```\n\n### Outputs\n```commandline\n[20:39:00] [main/debug]: test\n[20:39:00] [main/info]: test\n[20:39:00] [main/WARNING]: test\n[20:39:00] [main/ERROR]: test\n[20:39:00] [main/FATAL]: test\n```\n\n### Developing features\n- [ ] mutiple variable with different configs\n- [x] new config format\n- [ ] catch and format errors\n- [X] override config once\n\n\n### Config\n```python\nimport loggerjava\nloggerjava.config(**kwargs)\n\"\"\"\n:param kwargs:input config names and config data\nformat: config_name = config_data\n\nbelow are config_name and the description\n\nname : change the name of the log file, only actives when abolutepath config is off\n\nfileextension : change the extension of the log file, only actives when abolutepath config is off\n\nabsolutepath : change whether inputing the absolute path of the log file,\nTrue for using the name and fileextension to create file in the program running location\nFalse for using the route to create file in the specific location(note:you need to enter the file format,like:test.log)\n\nroute : change the file location, only activates when abolutepath config is on\nthe route should contain the\n\nfile_encoding : change the file encoding method\n\nshowdetailedtime : whether to show detailed time in the log file\n\nshowinconsole : whether to show the log in the python console\n\nfatalexit : whether to exit the program after a fatal log\n\n:return: none\n\"\"\"\n```\nusing `logger.exportconfig()` to export your current config\n\nand using `logger.inportconfig(inputconfig)` to inport your config\n\n### Exception handler\nusing the `loggerjava.exceptionhandler.exception(exc)` function to process an Exception\n\nremember to register the defs/classes after you created them\n\n```python\nimport loggerjava\nimport loggerjava.exceptionhandler\ndef test1(a):\n    print(b)\nclass test2():\n    def printa(self):\n        print(self.b)\nloggerjava.exceptionhandler.register_def(test1)\nloggerjava.exceptionhandler.register_def(test2)\nif __name__ == \"__main__\":\n    try:\n        test1(1)\n    except Exception as E:\n        loggerjava.error(loggerjava.exceptionhandler.handler(E))\n    try:\n        a = test2\n        a.printa()\n    except Exception as E:\n        loggerjava.error(loggerjava.exceptionhandler.handler(E))\n```\n#### Output\uff1a\n```commandline\n[20:39:00] [main/ERROR]: NameError: name 'b' is not defined\n    at <module> (test.py:30)\n    at test1.test1 (test.py:21)\n\n[20:39:00] [main/ERROR]: AttributeError: 'test2' object has no attribute 'b'\n    at <module> (test.py:35)\n    at test2.printa (test.py:25)\n```\n### Versions\n\n`v0.8.0` added the exceptionhandler and clearcurrentlog function\n\n`v0.7.6` change filetype -> fileextension, simplified the code, completed the override funciton\n\n`v0.7.5.dev1` follow SemVer, no actual updates\n\n`v0.0.7.5` edited the original log codes,adding \"log\" feature,add the fatalexit config\n\n`v0.0.7.2` adding the \"fatalexit\" feature,adding an easier log function(not completed)\n\n`v0.0.7.1` adding debug config,adding debug\n\n`v0.0.7` no actual updates, updating version num to ver x.x.x\n\n`0.0.6.1` update readme\n\n`0.0.6` change the config method, adding file_encoding,absolutepath,filetype config\n\n`0.0.5.1` rename outputconfig -> exportconfig\n\n`0.0.5` added the outputconfig and the loadconfig function,edited the config part to let it output log\n\n`0.0.4` upgrade the config sys and add helps\n\n`0.0.3` upload the descriptions\n\n`0.0.2` initial upload\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "an easy logger outputs like java logs",
    "version": "0.8.0",
    "project_urls": {
        "Homepage": "https://github.com/HTony03/loggerjava",
        "Issues": "https://github.com/HTony03/loggerjava/issues"
    },
    "split_keywords": [
        "python",
        " logger",
        " java_like"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "39602442fc4229364eadec80b888d70f7308e83f1f452bf2d983e475d1ab50ea",
                "md5": "c24ddd8417f7699b282effb198258ac3",
                "sha256": "86089f94bd800df64ebc51149ef69b1ec6942c494e3419600e5aca18abc93e47"
            },
            "downloads": -1,
            "filename": "loggerjava-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c24ddd8417f7699b282effb198258ac3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8758,
            "upload_time": "2024-04-12T15:23:44",
            "upload_time_iso_8601": "2024-04-12T15:23:44.779405Z",
            "url": "https://files.pythonhosted.org/packages/39/60/2442fc4229364eadec80b888d70f7308e83f1f452bf2d983e475d1ab50ea/loggerjava-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a70cce181ef053e5cb75907fa79ffbb6bcd2752a4db80478d944de01c6c3994f",
                "md5": "490a1d00ec82b1eae5525be9ad52235f",
                "sha256": "f6399e62ab085a1333d86cac943c2de4a8730f0c3535b19e680c6ddb10fa8e04"
            },
            "downloads": -1,
            "filename": "loggerjava-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "490a1d00ec82b1eae5525be9ad52235f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8898,
            "upload_time": "2024-04-12T15:23:48",
            "upload_time_iso_8601": "2024-04-12T15:23:48.520803Z",
            "url": "https://files.pythonhosted.org/packages/a7/0c/ce181ef053e5cb75907fa79ffbb6bcd2752a4db80478d944de01c6c3994f/loggerjava-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-12 15:23:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "HTony03",
    "github_project": "loggerjava",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "loggerjava"
}
        
Elapsed time: 0.50782s