@Promezio/

PythonLogging

Python

No description

fork
loading
Files
  • main.py
  • log_config.ini
  • logs

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.471976569878531","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"IwojICA6Iy8gcHJvbWV6aW8KIyAgd3d3LnByb21lemlvLml0CiMgIFB5dGhvbjogcGVyZm9ybWFuY2UgbWVhc3VyZW1lbnQKIyAgQ2hlY2sgbGlzdCB2cyBzZXQgcGVyZm9ybWFuY2Ugd2l0aCB0aW1laXQgYW5kIGNQcm9maWxlCiMKCgojIGltcG9ydCBuYXRpdmUgbG9nZ2luZyBsaWJzCmltcG9ydCBsb2dnaW5nCmltcG9ydCBsb2dnaW5nLmNvbmZpZwoKCgpkZWYgdGVzdF9sb2dzKCk6CiAgJycnIEEgZnVuY3Rpb24gdGhhdCBnZW5lcmF0ZXMgNSBsb2dzIG9mIGRpZmZlcmVudCBsZXZlbHMgJycnCgogIHByaW50KCI6Iy8gcHJvbWV6aW8gLSBURVNUIExPR1MiKQogIGxvZ2dpbmcuZGVidWcoJ0xvZyBAZGVidWcgbGV2ZWwnKQogIGxvZ2dpbmcuaW5mbygnTG9nIEBpbmZvIGxldmVsJykKICBsb2dnaW5nLndhcm5pbmcoJ0xvZyBAd2FybmluZyBsZXZlbCcpCiAgbG9nZ2luZy5lcnJvcignTG9nIEBlcnJvciBsZXZlbCcpCiAgbG9nZ2luZy5jcml0aWNhbCgnTG9nIEBjcml0aWNhbCBsZXZlbCcpCgoKCiMgTWFpbiBwcm9ncmFtCmlmIF9fbmFtZV9fID09ICJfX21haW5fXyI6CiAgIyBMb2FkIGxvZ2dpbmcgY29uZmlndXJhdGlvbiBmcm9tICJsb2dfY29uZmlnLmluaSIgZmlsZQogIGxvZ2dpbmcuY29uZmlnLmZpbGVDb25maWcoImxvZ19jb25maWcuaW5pIiwgZGlzYWJsZV9leGlzdGluZ19sb2dnZXJzPUZhbHNlKQoKICAjIEdlbmVyYXRlIHRlc3QgbG9ncwogIHRlc3RfbG9ncygp"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#
#  :#/ promezio
#  www.promezio.it
#  Python: performance measurement
#  Check list vs set performance with timeit and cProfile
#


# import native logging libs
import logging
import logging.config



def test_logs():
  ''' A function that generates 5 logs of different levels '''

  print(":#/ promezio - TEST LOGS")
  logging.debug('Log @debug level')
  logging.info('Log @info level')
  logging.warning('Log @warning level')
  logging.error('Log @error level')
  logging.critical('Log @critical level')



# Main program
if __name__ == "__main__":
  # Load logging configuration from "log_config.ini" file
  logging.config.fileConfig("log_config.ini", disable_existing_loggers=False)

  # Generate test logs
  test_logs()