logandprint


Namelogandprint JSON
Version 1.2.3 PyPI version JSON
download
home_pagehttps://github.com/guisaldanha/logandprint
SummaryA simple logging package that helps you to log what is happening in your application.
upload_time2023-08-21 12:07:12
maintainer
docs_urlNone
authorGuilherme Saldanha
requires_python
license
keywords python log logging print file
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Log and Print

[![PyPI version](https://img.shields.io/pypi/v/logandprint)](https://pypi.org/project/logandprint/) [![License](https://img.shields.io/github/license/guisaldanha/logandprint)](LICENSE) [![Downloads](https://img.shields.io/pypi/dm/logandprint)](https://img.shields.io/pypi/dm/logandprint)

A simple logging package that helps you to log what is happening in your application.

## Installation

You can install [Log and Print](https://pypi.org/project/logandprint/) using pip:

```bash
pip install logandprint
```

## Usage

To start logging it is as simple as importing the logandprint object and issuing the logging commands:

### write, info, error, success, warning, debug

To logging a message to the log:

```python
import logandprint as log

log.write("This is a common log message")
log.info("This is log information, it appears blue in the terminal")
log.error("This is an error message, it appears red in the terminal")
log.success("This is a success message, it appears green in the terminal")
log.warning("This is a warning message, it appears yellow in the terminal")
log.debug("This is a debug message, it appears white in the terminal")
```

The `write`, `info`, `error`, `success`, `warning` methods accept two parameters, the message and the console flag (boolean) to display or not the message in the terminal.

In the `debub` method, messages will only be displayed in the terminal if debug mode is active `log.debugMode(True)`

### setLogFile

By default, the log is saved in the `log.log` file in the current directory. But you can change the log file by using the `setLogFile` function.

```python
log.setLogFile("./logs/myLogFile.log")
```

### debugMode

The log packet will not be printed to the console. You can change this by setting `debugMode` to True.

```python
log.debugMode(True)
```

To stop printing to the console, change the `debugMode` setting to False. Don't worry, the log file will still be writing.

```python
log.debugMode(False)
```

### enable

To disable the `log` you can call the `enable` function and set it to False.

```python
log.enable(False)
```

And to enable it again you can call the `enable` function and set it to True.

```python
log.enable(True)
```

### export_to_csv

You can export the log to a csv file by calling the `export_to_csv` function.

```python
log.export_to_csv("./logs/myLogFile.csv")
```

## Author

- Guilherme Saldanha

## Copyright

This software is free to use and distribute. You can use it for any purpose, but please give credit to the original author.

For more info see LICENSE file.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/guisaldanha/logandprint",
    "name": "logandprint",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,log,logging,print,file",
    "author": "Guilherme Saldanha",
    "author_email": "guisaldanha@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0f/27/c820f12f904b5133a4b998ebd68bb6181118687da1d88bfbf5e4081381ba/logandprint-1.2.3.tar.gz",
    "platform": null,
    "description": "# Log and Print\n\n[![PyPI version](https://img.shields.io/pypi/v/logandprint)](https://pypi.org/project/logandprint/) [![License](https://img.shields.io/github/license/guisaldanha/logandprint)](LICENSE) [![Downloads](https://img.shields.io/pypi/dm/logandprint)](https://img.shields.io/pypi/dm/logandprint)\n\nA simple logging package that helps you to log what is happening in your application.\n\n## Installation\n\nYou can install [Log and Print](https://pypi.org/project/logandprint/) using pip:\n\n```bash\npip install logandprint\n```\n\n## Usage\n\nTo start logging it is as simple as importing the logandprint object and issuing the logging commands:\n\n### write, info, error, success, warning, debug\n\nTo logging a message to the log:\n\n```python\nimport logandprint as log\n\nlog.write(\"This is a common log message\")\nlog.info(\"This is log information, it appears blue in the terminal\")\nlog.error(\"This is an error message, it appears red in the terminal\")\nlog.success(\"This is a success message, it appears green in the terminal\")\nlog.warning(\"This is a warning message, it appears yellow in the terminal\")\nlog.debug(\"This is a debug message, it appears white in the terminal\")\n```\n\nThe `write`, `info`, `error`, `success`, `warning` methods accept two parameters, the message and the console flag (boolean) to display or not the message in the terminal.\n\nIn the `debub` method, messages will only be displayed in the terminal if debug mode is active `log.debugMode(True)`\n\n### setLogFile\n\nBy default, the log is saved in the `log.log` file in the current directory. But you can change the log file by using the `setLogFile` function.\n\n```python\nlog.setLogFile(\"./logs/myLogFile.log\")\n```\n\n### debugMode\n\nThe log packet will not be printed to the console. You can change this by setting `debugMode` to True.\n\n```python\nlog.debugMode(True)\n```\n\nTo stop printing to the console, change the `debugMode` setting to False. Don't worry, the log file will still be writing.\n\n```python\nlog.debugMode(False)\n```\n\n### enable\n\nTo disable the `log` you can call the `enable` function and set it to False.\n\n```python\nlog.enable(False)\n```\n\nAnd to enable it again you can call the `enable` function and set it to True.\n\n```python\nlog.enable(True)\n```\n\n### export_to_csv\n\nYou can export the log to a csv file by calling the `export_to_csv` function.\n\n```python\nlog.export_to_csv(\"./logs/myLogFile.csv\")\n```\n\n## Author\n\n- Guilherme Saldanha\n\n## Copyright\n\nThis software is free to use and distribute. You can use it for any purpose, but please give credit to the original author.\n\nFor more info see LICENSE file.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A simple logging package that helps you to log what is happening in your application.",
    "version": "1.2.3",
    "project_urls": {
        "Documentation": "https://github.com/guisaldanha/logandprint/README.md",
        "Homepage": "https://github.com/guisaldanha/logandprint",
        "Source": "https://github.com/guisaldanha/logandprint",
        "Tracker": "https://github.com/guisaldanha/logandprint/issues"
    },
    "split_keywords": [
        "python",
        "log",
        "logging",
        "print",
        "file"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1f81dcb355078c119cd06a5b324ae2c18f451886f4c541f0f7194ed1daa0b18c",
                "md5": "2b0bd317bb103f977d43e9a959e0e6e7",
                "sha256": "e0ab7c75271c065d91214b527bef161312a28c0f69da405ab171c5c88bb4c587"
            },
            "downloads": -1,
            "filename": "logandprint-1.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2b0bd317bb103f977d43e9a959e0e6e7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5183,
            "upload_time": "2023-08-21T12:07:11",
            "upload_time_iso_8601": "2023-08-21T12:07:11.152960Z",
            "url": "https://files.pythonhosted.org/packages/1f/81/dcb355078c119cd06a5b324ae2c18f451886f4c541f0f7194ed1daa0b18c/logandprint-1.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0f27c820f12f904b5133a4b998ebd68bb6181118687da1d88bfbf5e4081381ba",
                "md5": "5545f70cb0782fb02bb4afa0d10b6df5",
                "sha256": "a4453a8f21878488fbb4157d739397216af2147e133a1ff06740e6eda4f6adb4"
            },
            "downloads": -1,
            "filename": "logandprint-1.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "5545f70cb0782fb02bb4afa0d10b6df5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4687,
            "upload_time": "2023-08-21T12:07:12",
            "upload_time_iso_8601": "2023-08-21T12:07:12.124946Z",
            "url": "https://files.pythonhosted.org/packages/0f/27/c820f12f904b5133a4b998ebd68bb6181118687da1d88bfbf5e4081381ba/logandprint-1.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-21 12:07:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "guisaldanha",
    "github_project": "logandprint",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "logandprint"
}
        
Elapsed time: 0.11529s