Skip to main content

Log and Console library

Project description


It's gonna change the traditional tracing in another way.
What will it assist us.

  1. Colorise output
  2. Be able to stop any output via its public id
  3. Split each output with a big span and symbols
  4. Generate a new dynamic log filename
  5. Disable the entire tracking in a second
  6. 5 methods for 5 outputs

5 Methods

Use in different situation, and show up in different color

  1. track: track(title, content)
  2. information: info(title, content)
  3. success: success(title, content)
  4. warning: warning(title, content)
  5. error: error(title, content)
- title is a string
- content can be a string or dict

Start using in the simple way:

from smilelog import Logger, Consoler

# first instant
console	= Consoler(
            enable= True

# try to print out
	'My Info Title'
	, {'data':'My Dictionary Content'}

# success method
	'My Success Title'
        , 'My String'

Logger Vs. Consoler

1. 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, 
            prefix: str, 
            extension: str, 
            formatFileName: str, 
            enable: bool, 
            color: bool = True
  • path: is a directory
  • formatFileName: is suffix name of log file
# set filename
formatFileName = 'my-logger'

# in dynamic way
formatFileName = '%Y-%m-%d'
  • extension: is an extension of log file. The standard extension is '.log'
# set extension
extension = '.log'
  • prefix: is prefix name of a new file log.
# set prefix
prefix= 'my-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
color= False
  • enable: is a main parameter that determines above features. It has two value only.
    • True: To enable the logging
    • False: To disable the logging
# set enable
# make all above working
enable= True
2. Consoler

Consoler is a tracing class library and show in terminal as just in time. The class is simpler that Logger by just needing a couple parameters and no storage requirement.

As the first sample above:

console	= Consoler(
        enable= True

Disable print out

The most feature developer guy needs.
It will disable only the index that we set in the disable list.


console and log object are not related each other.

# Logger instant
# it shows all except 1,2,3

# Consolder instant
# it shows all except 3, 6, 7
console.disable([3, 6, 7, 89])


It's gonna show like this:

02:48:29 <id: 6>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[SUCCESS] Success 
{'data': 'my content'} 

02:48:29 <id: 8>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[WARNING] Warning 
{'data': 'my content'} 

02:48:29 <id: 9>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[SUCCESS] Success 
{'data': 'my content'} 

02:48:29 <id: 10>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[SUCCESS] Success 
Hello String 

My unique slogan is:

a little developer in the big world \o/

Project details

Download files

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

Files for SmileLog, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size SmileLog-1.0.2-py3-none-any.whl (6.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size SmileLog-1.0.2.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page