Skip to main content

Simple logger writen in c++

Project description

PictLogger

A simple logger writen in c++ For now, works only on Linux, X86_64 I`m trying to compile it for Windows, maybe it will be

You can see all sources at https://github.com/ilyadudelzak/pictlogger

How to use

To save files you need to create the "logs" folder near your main program

Simple example:

import pictlogger

pictlogger.start(True)

pictlogger.log("Testing", "Hello, World!")

pictlogger.close(0)

It prints and saves to the file:

Fri Oct 13 15:34:48 2023 Pictlogger: Started
Fri Oct 13 15:34:48 2023 PictLogger: Version: 0.0.1
Fri Oct 13 15:34:48 2023 Python: PictLogger Imported Successfully
Fri Oct 13 15:34:48 2023 Testing: Hello, World!
Fri Oct 13 15:34:48 2023 PictLogger: Exit with exit code: 0 (Success)

Example with exception

import pictlogger

pictlogger.start(True)

pictlogger.log("Testing", "Hello, World!")

try:
    n = int(input())
    pictlogger.log("Testing", "User entered number " + str(n));
    pictlogger.close(0)
    
except Exception as e:
    pictlogger.log("Exception", str(e))
    pictlogger.close(1)

it will print

Fri Oct 13 16:10:19 2023 Pictlogger: Started PictLogger
Fri Oct 13 16:10:19 2023 PictLogger: Version: 0.0.1
Fri Oct 13 16:10:19 2023 Python: PictLogger Imported Successfully
Fri Oct 13 16:10:19 2023 Testing: Hello, World!
1234
Fri Oct 13 16:10:21 2023 Testing: User entered number 1234
Fri Oct 13 16:10:21 2023 PictLogger: Exit with exit code: 0 (Success)

Or

Fri Oct 13 16:10:37 2023 Pictlogger: Started PictLogger
Fri Oct 13 16:10:37 2023 PictLogger: Version: 0.0.1
Fri Oct 13 16:10:37 2023 Python: PictLogger Imported Successfully
Fri Oct 13 16:10:37 2023 Testing: Hello, World!
kitten
Fri Oct 13 16:10:41 2023 Exception: invalid literal for int() with base 10: 'kitten'
Fri Oct 13 16:10:41 2023 PictLogger: Exit with exit code: 1 (Error)

Documentation

start(print)

Starts library, opens the file.

print is True or False

If it is true, library will print all logs to the screen.

If if is false, it will not print logs, but save all to the file, like before.

log(sender, text)

It will save log string to file and print it, if you setted print to true.

sender is string, thal prints before text. text is string, that prints after text, it contains main sense of the log.

close(code)

Closes output and saves files Call at end of program

code is number, that is an exit code of your program. Library will print it after exit message

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

PictLogger-0.1.3.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

PictLogger-0.1.3-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file PictLogger-0.1.3.tar.gz.

File metadata

  • Download URL: PictLogger-0.1.3.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for PictLogger-0.1.3.tar.gz
Algorithm Hash digest
SHA256 09fa709c061b1f132a7c7a8134efd45757d97c4aabb86f96b70f559a95d08c77
MD5 4f265b6df0080d38c31f3412eb18d161
BLAKE2b-256 3f341bb9c1a3272cf5966648c0aa350325cd102fcba8af6b82bc9fa618e9cd3c

See more details on using hashes here.

File details

Details for the file PictLogger-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: PictLogger-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for PictLogger-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e36111ae5bd40301f7b217c2985cad50a765d1d245e42220f4c862be2f817aab
MD5 dacee7392936ab3080b2491e845fbb60
BLAKE2b-256 9ed13aa32b9a8d47646a005fd0085ef9f3d10c0ee42ee20784d8527ae00f509b

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