SmileLog


NameSmileLog JSON
Version 4.1.4 PyPI version JSON
download
home_pagehttps://github.com/sitthykun/smilelog
SummaryLog library
upload_time2024-01-04 09:03:49
maintainer
docs_urlNone
authorSitthykun LY
requires_python>=3.8
licenseMIT License
keywords smilelog log logger console consoler trace tracking redis
VCS
bugtrack_url
requirements redis SmileArgs
Travis-CI
coveralls test coverage No coveralls.
            # SmileLog
![smilelog](https://user-images.githubusercontent.com/227092/76993446-6e44ff00-697f-11ea-9aed-970b8fa0e126.png)
**SmileLog 4.1.4**\
Appending a silent feature which auto-remove itself the current content file if over a limit that given by a parameter 'maxMb'.
It won't do anything unless the value of the 'autoclean' equals 'False'.
```
autoclean= True
maxMb=100
```
Every writing a log, it will check these value.

The features since version 4.x.x:
- Log to a static file
- Backup file everyday
- Enable series of log session
- Parallel log between static log and session log
- Push any log to redis via pubsub method
- Dynamic line separation
  - on or off
  - editable line character
  - editable number of line character
- Fix bugs
- Improve performance
- Clean up code

It's going to change the traditional tracing in another way.\
What will it assist us:
 
1. Showing the colorized log by following the standard color
2. Ignoring any track by reading id in the list 
3. Each statement list down with a big span and symbols
4. Using a static file to output the content that will be easier
5. Disable the entire tracing in a second
6. 5 methods for 5 outputs
7. Backup file if log start a new date
8. Separating a new file with a new file name
This feature will cover to a specific tracking.
9. Group the log with specific key(series key)
10. Able to set maxSize log

It is available on **PyPi** store via https://pypi.org/project/SmileLog/ \
To Support my work, please donate me via <a class="bmc-button" target="_blank" href="https://www.buymeacoffee.com/sitthykun"><img src="https://cdn.buymeacoffee.com/buttons/bmc-new-btn-logo.svg" alt="Buy me a Pizza"><span style="margin-left:5px;font-size:28px !important;">Buy me a Coffee</span></a>
 
#### Installation
```
# pip3 install SmileLog
```

### 5 Methods
Use in the different situation, and show up in different color
1. error: error(title, content, id= None, channel= None)
2. fail: fail(title, content, id= None, channel= None)
3. information: info(title, content, id= None, channel= None)
4. success: success(title, content, id= None, channel= None)
5. track: track(title, content, id= None, channel= None)
6. warning: warning(title, content, id= None, channel= None)
```
- title is a string
- content can be a string or dict
Figure (version 2.0)
```
![smilelog-output](https://user-images.githubusercontent.com/227092/76993665-c845c480-697f-11ea-862d-8622cca09f14.png)

#### Start using in the simple way:

```
from smilelog import Logger


# first instant
log	= Logger(
            enableLog= True
	)

# try to print out
log.info(
	'My Info Title'
	, {'data':'My Dictionary Content'}
)

# success method
log.success(
	title	 	= 'My Success Title'
	, content	= 'My String'
)

# setKeySeries is a new method to indicate to the token of a long message
log.setKeySeries('NbcseX32cDse')
```

### Logger
Logger is a tracing class library and write/output into a file.\
This will need generating a file and keep writing the content.
Let's Look at its configure would explain more:

```
log	= Logger(
           path:                str	= 'log'
           , filename: 			str = 'access'
           , extension: 		str = 'log'  
            , enableLog: 		bool= True
            , enableConsole:    bool= True
            , line: 			bool= True
            , charInLine: 		int	= 55
            , lineCharStart:    str = '>'
            , lineCharEnd: 		str = '<',
            , color: 			bool= True
            , autoClean:        bool= False
            , maxMb:            int=100
	)
```
- **path**: is a directory
```
Ex:
/var/www/my-project/logs/

```
- **filename**: is the name of a new file log. 
```
# set name
filename= 'access'

Ex: 
/var/www/my-project/logs/access.log 
# some app move it into system log directory, it is an advantage of prefix

```
- **color**: is for showing the color on terminal with tail command or terminal editor.
```
# set color
color= True
or
color= False
```
- **enableLog**: allow an object to create the file.
	- True: To create a file and write content into log file
	- False: To disable the logging
```
# set enable
# enable to write log file
enableLog= True
```

- **enableConsole**: to bring something on the screen of log.
	- True: To print out on terminal
	- False: No action
```
# set enable
enableConsole= True
```

### Series
Just a series name of output
- **setKeySeries**: data
```
# set value
log.setKeySeries('Insert Data')
# stop
log.setKeySeries()
```

### Disable print out
The most feature developer guy needs.\
It will disable only the index that we set in disable list.
- **disableIds**: hide those ids.
  - parameter must be Array

```
# Logger instant
# Ex: Logger logged 10 times
# but we will show some id except 1,2,3,7,8,9
# do this
log.disableIds([1,2,3,7,8,9])
```

### Separate a session file 
Here is the method to separate normal log file to a specific.
Follow the setting: 
- **setKeySession**: must be a string and maximum length 32

```
log.setKeySession('cbc98494543823442425488df')
```
It will separate from the default log, and generate a new file as 'cbc98494543823442425488df.log'.
##### Note: 
To stop running a session, just set it the None.
```
log.setKeySession()
```

2022-05-12 21:40:20.345 <id: 4>\
_>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\
[FAIL] **My Title**\
{'data': 'my content'}  
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<



2022-05-12 21:40:20.345 <id: 5> Insert Data\
_>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\
[WARNING] **Warning**\
{'data': 'my content'}\
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<



2022-05-12 21:40:20.345 <id: 6> Delete Row\
[TRACK] My Title\
{'data': 'my content'}



2022-05-12 21:40:20.345 <id: 10>\
[SUCCESS] **Success**\
Hello String

## Pub/Sub
#### initializes redis requirement
- setRedis
  - host: required
  - port: required
  - channel: the default is None, scribe and publish
  - db: by default is 0
  - password: by default is None
### enable Redis Engine
- enableRedis: bool
#### enable any functional alert
- enableError: bool
- enableFail: bool
- enableInfo: bool
- enableTrack: bool
- enableSuccess: bool
- enableWarning: bool

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sitthykun/smilelog",
    "name": "SmileLog",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "smilelog,log,logger,console,consoler,trace,tracking,redis",
    "author": "Sitthykun LY",
    "author_email": "ly.sitthykun@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c6/e7/fa5606db809cdee754a125430f547e247c9cde0884d22da4fff4a2e3a2ff/SmileLog-4.1.4.tar.gz",
    "platform": "All",
    "description": "# SmileLog\n![smilelog](https://user-images.githubusercontent.com/227092/76993446-6e44ff00-697f-11ea-9aed-970b8fa0e126.png)\n**SmileLog 4.1.4**\\\nAppending a silent feature which auto-remove itself the current content file if over a limit that given by a parameter 'maxMb'.\nIt won't do anything unless the value of the 'autoclean' equals 'False'.\n```\nautoclean= True\nmaxMb=100\n```\nEvery writing a log, it will check these value.\n\nThe features since version 4.x.x:\n- Log to a static file\n- Backup file everyday\n- Enable series of log session\n- Parallel log between static log and session log\n- Push any log to redis via pubsub method\n- Dynamic line separation\n  - on or off\n  - editable line character\n  - editable number of line character\n- Fix bugs\n- Improve performance\n- Clean up code\n\nIt's going to change the traditional tracing in another way.\\\nWhat will it assist us:\n \n1. Showing the colorized log by following the standard color\n2. Ignoring any track by reading id in the list \n3. Each statement list down with a big span and symbols\n4. Using a static file to output the content that will be easier\n5. Disable the entire tracing in a second\n6. 5 methods for 5 outputs\n7. Backup file if log start a new date\n8. Separating a new file with a new file name\nThis feature will cover to a specific tracking.\n9. Group the log with specific key(series key)\n10. Able to set maxSize log\n\nIt is available on **PyPi** store via https://pypi.org/project/SmileLog/ \\\nTo Support my work, please donate me via <a class=\"bmc-button\" target=\"_blank\" href=\"https://www.buymeacoffee.com/sitthykun\"><img src=\"https://cdn.buymeacoffee.com/buttons/bmc-new-btn-logo.svg\" alt=\"Buy me a Pizza\"><span style=\"margin-left:5px;font-size:28px !important;\">Buy me a Coffee</span></a>\n \n#### Installation\n```\n# pip3 install SmileLog\n```\n\n### 5 Methods\nUse in the different situation, and show up in different color\n1. error: error(title, content, id= None, channel= None)\n2. fail: fail(title, content, id= None, channel= None)\n3. information: info(title, content, id= None, channel= None)\n4. success: success(title, content, id= None, channel= None)\n5. track: track(title, content, id= None, channel= None)\n6. warning: warning(title, content, id= None, channel= None)\n```\n- title is a string\n- content can be a string or dict\nFigure (version 2.0)\n```\n![smilelog-output](https://user-images.githubusercontent.com/227092/76993665-c845c480-697f-11ea-862d-8622cca09f14.png)\n\n#### Start using in the simple way:\n\n```\nfrom smilelog import Logger\n\n\n# first instant\nlog\t= Logger(\n            enableLog= True\n\t)\n\n# try to print out\nlog.info(\n\t'My Info Title'\n\t, {'data':'My Dictionary Content'}\n)\n\n# success method\nlog.success(\n\ttitle\t \t= 'My Success Title'\n\t, content\t= 'My String'\n)\n\n# setKeySeries is a new method to indicate to the token of a long message\nlog.setKeySeries('NbcseX32cDse')\n```\n\n### Logger\nLogger is a tracing class library and write/output into a file.\\\nThis will need generating a file and keep writing the content.\nLet's Look at its configure would explain more:\n\n```\nlog\t= Logger(\n           path:                str\t= 'log'\n           , filename: \t\t\tstr = 'access'\n           , extension: \t\tstr = 'log'  \n            , enableLog: \t\tbool= True\n            , enableConsole:    bool= True\n            , line: \t\t\tbool= True\n            , charInLine: \t\tint\t= 55\n            , lineCharStart:    str = '>'\n            , lineCharEnd: \t\tstr = '<',\n            , color: \t\t\tbool= True\n            , autoClean:        bool= False\n            , maxMb:            int=100\n\t)\n```\n- **path**: is a directory\n```\nEx:\n/var/www/my-project/logs/\n\n```\n- **filename**: is the name of a new file log. \n```\n# set name\nfilename= 'access'\n\nEx: \n/var/www/my-project/logs/access.log \n# some app move it into system log directory, it is an advantage of prefix\n\n```\n- **color**: is for showing the color on terminal with tail command or terminal editor.\n```\n# set color\ncolor= True\nor\ncolor= False\n```\n- **enableLog**: allow an object to create the file.\n\t- True: To create a file and write content into log file\n\t- False: To disable the logging\n```\n# set enable\n# enable to write log file\nenableLog= True\n```\n\n- **enableConsole**: to bring something on the screen of log.\n\t- True: To print out on terminal\n\t- False: No action\n```\n# set enable\nenableConsole= True\n```\n\n### Series\nJust a series name of output\n- **setKeySeries**: data\n```\n# set value\nlog.setKeySeries('Insert Data')\n# stop\nlog.setKeySeries()\n```\n\n### Disable print out\nThe most feature developer guy needs.\\\nIt will disable only the index that we set in disable list.\n- **disableIds**: hide those ids.\n  - parameter must be Array\n\n```\n# Logger instant\n# Ex: Logger logged 10 times\n# but we will show some id except 1,2,3,7,8,9\n# do this\nlog.disableIds([1,2,3,7,8,9])\n```\n\n### Separate a session file \nHere is the method to separate normal log file to a specific.\nFollow the setting: \n- **setKeySession**: must be a string and maximum length 32\n\n```\nlog.setKeySession('cbc98494543823442425488df')\n```\nIt will separate from the default log, and generate a new file as 'cbc98494543823442425488df.log'.\n##### Note: \nTo stop running a session, just set it the None.\n```\nlog.setKeySession()\n```\n\n2022-05-12 21:40:20.345 <id: 4>\\\n_>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\\\n[FAIL] **My Title**\\\n{'data': 'my content'}  \n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n\n\n\n2022-05-12 21:40:20.345 <id: 5> Insert Data\\\n_>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\\\n[WARNING] **Warning**\\\n{'data': 'my content'}\\\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n\n\n\n2022-05-12 21:40:20.345 <id: 6> Delete Row\\\n[TRACK] My Title\\\n{'data': 'my content'}\n\n\n\n2022-05-12 21:40:20.345 <id: 10>\\\n[SUCCESS] **Success**\\\nHello String\n\n## Pub/Sub\n#### initializes redis requirement\n- setRedis\n  - host: required\n  - port: required\n  - channel: the default is None, scribe and publish\n  - db: by default is 0\n  - password: by default is None\n### enable Redis Engine\n- enableRedis: bool\n#### enable any functional alert\n- enableError: bool\n- enableFail: bool\n- enableInfo: bool\n- enableTrack: bool\n- enableSuccess: bool\n- enableWarning: bool\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Log library",
    "version": "4.1.4",
    "project_urls": {
        "Homepage": "https://github.com/sitthykun/smilelog"
    },
    "split_keywords": [
        "smilelog",
        "log",
        "logger",
        "console",
        "consoler",
        "trace",
        "tracking",
        "redis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5c1f1feda8913fc4b9992f6e53e79fb724dab2868e6d21e1fa91448fd065cd5b",
                "md5": "206646af3b0def20f7833a01a6413a40",
                "sha256": "c306b41accb8969b0e96b2ed3214dafeccb2f42f8dc23d61ce8117d13b81077c"
            },
            "downloads": -1,
            "filename": "SmileLog-4.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "206646af3b0def20f7833a01a6413a40",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11949,
            "upload_time": "2024-01-04T09:03:47",
            "upload_time_iso_8601": "2024-01-04T09:03:47.753597Z",
            "url": "https://files.pythonhosted.org/packages/5c/1f/1feda8913fc4b9992f6e53e79fb724dab2868e6d21e1fa91448fd065cd5b/SmileLog-4.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c6e7fa5606db809cdee754a125430f547e247c9cde0884d22da4fff4a2e3a2ff",
                "md5": "bfa6502fe083cfb4bccc8d0dbae34363",
                "sha256": "854d963b46eb381be0b75e56f8c3438b821a0714a711e225c76c7d99c76d7601"
            },
            "downloads": -1,
            "filename": "SmileLog-4.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "bfa6502fe083cfb4bccc8d0dbae34363",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 10618,
            "upload_time": "2024-01-04T09:03:49",
            "upload_time_iso_8601": "2024-01-04T09:03:49.200038Z",
            "url": "https://files.pythonhosted.org/packages/c6/e7/fa5606db809cdee754a125430f547e247c9cde0884d22da4fff4a2e3a2ff/SmileLog-4.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-04 09:03:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sitthykun",
    "github_project": "smilelog",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "redis",
            "specs": [
                [
                    "==",
                    "5.0.0"
                ]
            ]
        },
        {
            "name": "SmileArgs",
            "specs": [
                [
                    "==",
                    "1.0.1"
                ]
            ]
        }
    ],
    "lcname": "smilelog"
}
        
Elapsed time: 0.17170s