Skip to main content

The definitive tools to print pretty error log message

Project description

CndPrint

CndPrint is a simple and elegant log display library. It allow you from one place to display more or less log message.

>>>> import cndprint
>>>> cnd_print = CndPrint()
>>>> cnd_print.log_e("Hello")
25/07/2022 22:59:54#|#Hello

instanciate the class

uuid

UUID will be display in beginning of each log message (after date). It can allow you to identify a unique run ID (very usefull if you use a log agregator)

level

Switch to log, info or trace to display more or less message

silent mode

use this for example in automated testing mode, when you don't need any message

Multiple event familly with color

You can use 5 event familly :

  • e : Usually use for Error (red)
  • s : Any Success event (green)
  • d : Use when i decide to go Down into a method(blue)
  • c : Use when you Call another method (cyan)
  • v : use for warning of simply Verbose (yellow)

Some exemple :

>>>> import cndprint
>>>> cnd_print = CndPrint()
cnd_print.log_e("You failed ! that's not good !")
cnd_print.log_s("You got it baby !")
cnd_print.log_d("Start looping into for")
cnd_print.log_c("Now calling sub method")
cnd_print.log_v("what the waether today ?")

Multiple level for printing

You can define 3 level for log filtering : 'trace', 'log', 'info'

trace error can be identify with trace_ trace display trace, log and info log display log and info info display only info

By default Info is actif, to use another level simplye use this

level=log (default)

import cndprint
cnd_print = CndPrint()
cnd_print.log_e("Hello Log")
cnd_print.info_e("Hello Info")
cnd_print.trace_e("Hello Trace")

will result in this

25/07/2022 22:59:54#|#Hello Log

level=info

But the same code, if you just replace

import cndprint
cnd_print = CndPrint(level='info')
cnd_print.log_e("Hello Log")
cnd_print.info_e("Hello Info")
cnd_print.trace_e("Hello Trace")

the print is now

25/07/2022 22:59:54#|#Hello Log
25/07/2022 22:59:54#|#Hello Info

level=trace

But the same code, if you just replace

import cndprint
cnd_print = CndPrint(level='trace')
cnd_print.log_e("Hello Log")
cnd_print.info_e("Hello Info")
cnd_print.trace_e("Hello Trace")

the print is now

25/07/2022 22:59:54#|#Hello Log
25/07/2022 22:59:54#|#Hello Info
25/07/2022 22:59:54#|#Hello Trace

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

cndprint-0.1.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

cndprint-0.1.2-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file cndprint-0.1.2.tar.gz.

File metadata

  • Download URL: cndprint-0.1.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for cndprint-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c378cc04638daddc7ad83ddd1bb40fd727b813ffbdd4f159d2739179c32b5a68
MD5 9130652dcb1ed47490a1af086e6982f7
BLAKE2b-256 e0532d280acb582c30fe2b4e119dde600bc85a98d18a2e3b3ea563f89c4aabb8

See more details on using hashes here.

File details

Details for the file cndprint-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: cndprint-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for cndprint-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 21f3def5fc638546430d7e7854763a69a8cf3f40a9bf6c2c7f101b0ea75ff909
MD5 ae989f2837e2399fdc7ca65627c0c0ad
BLAKE2b-256 31529ba5aa8d64745fedd7eeda96e993c1e55aa798aafc8ff606992d60a7313c

See more details on using hashes here.

Supported by

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