# Server monitoring Discord Bot Logger
This is a logger used by the [Server Monitoring Discord Bot](https://github.com/NightKey/Server-monitoring-discord-bot) and every module created for it by me.
## Possible log formats:
* [COUNTER] [LEVEL]: DATA{END}
* [COUNTER] [FILE_NAME->METHOD_1->...->CALLER]: DATA{END}
* [COUNTER] [METHOD_1->...->CALLER]: DATA{END}
## Available log levels:
* TRACE
* DEBUG
* INFO
* WARNING
* ERROR
* HEADER
## Options:
| Variable name | Description | Default value |
|:-----------------------------------|:---------------------------------------------------------------------------|:------------------:|
| log_file_name | The name of the log file | None |
| log_folder | The path of the folder to save the log file | Current Directory |
| clear | Clears the log file every time it's initialized | False |
| level | Sets the minimum level for the logger to show | INFO |
| log_to_console | Sets to log to console too | True |
| storage_life_extender_mode | Limits the writes to the file by caching the data | False |
| max_logfile_size | Limits the size of one log file in MB | -1 (No limit) |
| max_logfile_lifetime | Limits the time a log file can live (except the currently used one) | -1 (No limit) |
| __print | Callable for consol logging | stdout.write |
| __error | Callable for consol error logging. None sets to be __print | stderr.write |
| use_caller_name | Use the caller's name in consol logging instead of the level | False |
| use_file_names | Use the file name whe using the caller name or not | True |
| use_log_name | Use the log file name to differenciate between multiple loggers on console | False |
| level_only_valid_for_console | Sets to log the unwanted levels but don't display them in console | False |
| log_disabled | Disables logging to everywhere, and disables warning about silent logging | False |
## Additional info
The consol logging uses colors for the different levels to be more recognisable at a glance. It also supports headers, after which it indents the logs to add some structure.
### TRACE
- `#00E6E5`
### DEBUG
- `#E600E5`
### INFO
- `#0BFF00`
### WARNING
- `#FEFF00`
### ERROR
- `#FF0000`
### HEADER
- `#4182B7`
## Available methods
### get_buffer()
Return sthe buffer's content in a list, if the logger is set to use buffers.
### flush_buffer()
Forces a writes of the buffer to the log file.
### set_level(level)
Sets the loggers leve to be used from this point onwards.
### set_folder(folder)
Sets the loggers folder to be used from thi point. It also runs the basic validation on the inputed path.
### log(level, data, counter = str(datetime.now()), end = "\n")
Creates a log entry with the given level.
### header(data, counter = str(datetime.now()), end = "\n")
Creates a HEADER level log entry.
### trace(data, counter = str(datetime.now()), end = "\n")
Creates a TRACE level log entry.
### debug(data, counter = str(datetime.now()), end = "\n")
Creates a DEBUG level log entry.
### warning(data, counter = str(datetime.now()), end = "\n")
Creates a WARNING level log entry.
### info(data, counter = str(datetime.now()), end = "\n")
Creates a INFO level log entry.
### error(data, counter = str(datetime.now()), end = "\n")
Creates a ERROR level log entry.
Raw data
{
"_id": null,
"home_page": "https://github.com/NightKey/smdb-logger",
"name": "smdb-logger",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Janth\u00f3 D\u00e1vid",
"author_email": "davidjantho@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/65/be/984211fbe7ac9967501f65662a98bc2c9971d6f45588563da2f342e4b544/smdb_logger-0.6.0.tar.gz",
"platform": null,
"description": "# Server monitoring Discord Bot Logger\r\n\r\nThis is a logger used by the [Server Monitoring Discord Bot](https://github.com/NightKey/Server-monitoring-discord-bot) and every module created for it by me.\r\n\r\n## Possible log formats:\r\n\r\n * [COUNTER] [LEVEL]: DATA{END}\r\n * [COUNTER] [FILE_NAME->METHOD_1->...->CALLER]: DATA{END}\r\n * [COUNTER] [METHOD_1->...->CALLER]: DATA{END}\r\n\r\n## Available log levels:\r\n\r\n * TRACE\r\n * DEBUG\r\n * INFO\r\n * WARNING\r\n * ERROR\r\n * HEADER\r\n\r\n## Options:\r\n\r\n | Variable name | Description | Default value |\r\n |:-----------------------------------|:---------------------------------------------------------------------------|:------------------:|\r\n | log_file_name | The name of the log file | None |\r\n | log_folder | The path of the folder to save the log file | Current Directory |\r\n | clear | Clears the log file every time it's initialized | False |\r\n | level | Sets the minimum level for the logger to show | INFO |\r\n | log_to_console | Sets to log to console too | True |\r\n | storage_life_extender_mode | Limits the writes to the file by caching the data | False |\r\n | max_logfile_size | Limits the size of one log file in MB | -1 (No limit) |\r\n | max_logfile_lifetime | Limits the time a log file can live (except the currently used one) | -1 (No limit) |\r\n | __print | Callable for consol logging | stdout.write |\r\n | __error | Callable for consol error logging. None sets to be __print | stderr.write |\r\n | use_caller_name | Use the caller's name in consol logging instead of the level | False |\r\n | use_file_names | Use the file name whe using the caller name or not | True |\r\n | use_log_name | Use the log file name to differenciate between multiple loggers on console | False |\r\n | level_only_valid_for_console | Sets to log the unwanted levels but don't display them in console | False |\r\n | log_disabled | Disables logging to everywhere, and disables warning about silent logging | False |\r\n\r\n## Additional info\r\n\r\nThe consol logging uses colors for the different levels to be more recognisable at a glance. It also supports headers, after which it indents the logs to add some structure.\r\n\r\n### TRACE\r\n\r\n - `#00E6E5`\r\n\r\n### DEBUG\r\n\r\n - `#E600E5`\r\n\r\n### INFO\r\n\r\n - `#0BFF00`\r\n\r\n### WARNING\r\n\r\n - `#FEFF00`\r\n\r\n### ERROR\r\n\r\n - `#FF0000`\r\n\r\n### HEADER\r\n\r\n - `#4182B7`\r\n\r\n## Available methods\r\n\r\n### get_buffer()\r\n\r\n Return sthe buffer's content in a list, if the logger is set to use buffers.\r\n\r\n### flush_buffer()\r\n\r\n Forces a writes of the buffer to the log file.\r\n\r\n### set_level(level)\r\n\r\n Sets the loggers leve to be used from this point onwards.\r\n\r\n### set_folder(folder)\r\n\r\n Sets the loggers folder to be used from thi point. It also runs the basic validation on the inputed path.\r\n\r\n### log(level, data, counter = str(datetime.now()), end = \"\\n\")\r\n\r\n Creates a log entry with the given level.\r\n\r\n### header(data, counter = str(datetime.now()), end = \"\\n\")\r\n\r\n Creates a HEADER level log entry.\r\n\r\n### trace(data, counter = str(datetime.now()), end = \"\\n\")\r\n\r\n Creates a TRACE level log entry.\r\n\r\n### debug(data, counter = str(datetime.now()), end = \"\\n\")\r\n \r\n Creates a DEBUG level log entry.\r\n\r\n### warning(data, counter = str(datetime.now()), end = \"\\n\")\r\n\r\n Creates a WARNING level log entry.\r\n\r\n### info(data, counter = str(datetime.now()), end = \"\\n\")\r\n\r\n Creates a INFO level log entry.\r\n\r\n### error(data, counter = str(datetime.now()), end = \"\\n\")\r\n\r\n Creates a ERROR level log entry.\r\n \r\n",
"bugtrack_url": null,
"license": null,
"summary": "Logger used by Server Monitoring Discord Bot and all extentions made by me",
"version": "0.6.0",
"project_urls": {
"Bug Tracker": "https://github.com/NightKey/smdb-logger/issues",
"Homepage": "https://github.com/NightKey/smdb-logger"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5ccfb0e9931fcdd6e5d7c358a474b373d82a39796d1e0408a1d2c36a44957ae9",
"md5": "44e053f7d3214ef87cf9b5023c40fe4c",
"sha256": "4f6c644e12944292afd4e858c57c48aba7bd7b8c140ee9d90bd451432169ce5f"
},
"downloads": -1,
"filename": "smdb_logger-0.6.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "44e053f7d3214ef87cf9b5023c40fe4c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 6881,
"upload_time": "2024-08-31T09:57:47",
"upload_time_iso_8601": "2024-08-31T09:57:47.183432Z",
"url": "https://files.pythonhosted.org/packages/5c/cf/b0e9931fcdd6e5d7c358a474b373d82a39796d1e0408a1d2c36a44957ae9/smdb_logger-0.6.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "65be984211fbe7ac9967501f65662a98bc2c9971d6f45588563da2f342e4b544",
"md5": "a92886c4dd6a2bc7237ce801f061ee51",
"sha256": "a7887c81b6a1ef7703f3e2deaf2351be5e9e84fe57306997181ecd3a736dc7aa"
},
"downloads": -1,
"filename": "smdb_logger-0.6.0.tar.gz",
"has_sig": false,
"md5_digest": "a92886c4dd6a2bc7237ce801f061ee51",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 6736,
"upload_time": "2024-08-31T09:57:48",
"upload_time_iso_8601": "2024-08-31T09:57:48.662915Z",
"url": "https://files.pythonhosted.org/packages/65/be/984211fbe7ac9967501f65662a98bc2c9971d6f45588563da2f342e4b544/smdb_logger-0.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-31 09:57:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "NightKey",
"github_project": "smdb-logger",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "smdb-logger"
}