Skip to main content

No project description provided

Project description

SyraBroX - Libarys

ErrorLaw

The errorlaw function logs error details based on specified intents. It can log messages to a file, print them to the console, or return the details as a string.

Function Signature

def errorlaw(exception, intents, filename="Error_Logs.txt"):

Parameters

exception (Exception):

  • The exception object to retrieve error details from.

intents (str):

  • A string of numbers, each specifying an action to include in the output.

filename (str, optional):

  • Log file name if intent '7' is set (default: "Error_Logs.txt").

Intents

Each character in intents represents a type of error information to include:

  • '1': Error type (type(exception).name)
  • '2': Error message (again)
  • '3': File name where the exception occurred
  • '4': Full path of the script
  • '5': Line number where the error occurred
  • '6': Full traceback
  • '7': Append log to file (filename)
  • '8': Print log to console
  • '9': Return log as a string

Returns

Returns the log as a string if intent '9' is set, otherwise None.

Example Usage

try:
    1 / 0
except Exception as e:
    errorlaw(e, "123456789", "file_name.txt (optional)")

This captures various error details, saves to a file, prints, and returns the log entry.

Requirements

Ensure os and traceback libraries are imported.

License Copyright 2024 SyraBroX

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

syrabrox-4.0.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

syrabrox-4.0.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file syrabrox-4.0.0.tar.gz.

File metadata

  • Download URL: syrabrox-4.0.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for syrabrox-4.0.0.tar.gz
Algorithm Hash digest
SHA256 c53e201a6a93f6d866abd48867f818bea69b9a13e341474665c21270afbace48
MD5 b3cc8a15b09f69c7dafa788eaeb7ae8f
BLAKE2b-256 2ec60a345e6acd3f5bac6cfd38133663ba4e9906bd91c98d684644b62cb8d031

See more details on using hashes here.

File details

Details for the file syrabrox-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: syrabrox-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for syrabrox-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9bc78394232999124e41ba7e084ce05527fa0a89fef1f13e6cc140c2edf3cf4
MD5 ee91adce471c9223a6ae9165767f93a0
BLAKE2b-256 b203f3868c1a4a87f5feedcb57b4f02ebd205fecdfdde933151a22d17ad6f3a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page