You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,15 @@ A simple logger made primarily for my own personal use. Was made out of a combin
4
4
5
5
## Installation
6
6
7
-
smooth_logger can be installed through pip. Either download the latest release from Codeberg/GitHub, or do `pip install smooth_logger` to install from PyPi. For the latest commits, check the `dev`branches on the repositories.
7
+
smooth_logger can be installed through pip. Either download the latest release from GitHub, or do `pip install smooth_logger` to install from PyPi. For the latest commits, check the `dev`branch on the repository.
8
8
9
9
smooth_logger is currently devloped using Python 3.11, but should work with Python 3.5 and up. A minimum of 3.5 is required due to the project's use of type hinting, which was introduced in that version.
10
10
11
-
smooth_logger supports Linux, macOS and Windows.
11
+
smooth_logger supports Linux, macOS and Windows and will be able to automatically create a folder for storing log files on these operating systems. Other operating systems are not officially supported, but you may still be able to use them by providing a custom config path. See the Initialisation section, below, for more.
12
+
13
+
### Requirements
14
+
15
+
- smooth_logger uses the `plyer` library to send desktop notifications.
12
16
13
17
## Usage
14
18
@@ -20,8 +24,7 @@ The `Logger` model provides a number of methods for your use:
20
24
-`Logger.clean()` erases all log entries currently in memory.
21
25
-`Logger.edit_scope()` modifies the category of an existing scope.
22
26
-`Logger.get()` allows you to retrieve either the most recent log entry or all log entries, optionally filtered by scope.
23
-
-`Logger.get_time()` returns the full date & time, or optionally just the date, in ISO-8601 formatting.
24
-
-`Logger.init_bar()` initialises the `ProgressBar` model imported from the `smooth_progress` dependency.
27
+
-`Logger.is_scope()` can be queried with a scope name to check if the scope exists, and optionally with a category to check if the scope is set to it.
25
28
-`Logger.notify()` sends a desktop notification using the `plyer` dependency.
26
29
-`Logger.new()` creates and, depending on scope, prints a new log entry.
27
30
-`Logger.output()` saves all log entries of appropriate scope to the log file and cleans the log array for the next group of log entries. A new log file is created for each new day. This method only attempts to create or update the log file if there are entries of an appropriate scope to be written to it; if there are none, it just executes `Logger.clean()`.
@@ -58,17 +61,18 @@ Every log message is associated with a scope. This is an all-caps prefix to the
58
61
- INFO: General information for the user.
59
62
- WARNING: Things that have no immediate impact to functionality but could cause errors later on.
60
63
61
-
You can also use the value "NOSCOPE" to indicate that a message should be printed without a prefixed scope. Messages with no scope are printed to the console, not saved to the output file, and are not accompanied by a timestamp.
64
+
You can also forgo passing a scope or pass a None value to indicate that a message should be printed without a prefixed scope. Messages with no scope are printed to the console, not saved to the output file, and are not accompanied by a timestamp.
62
65
63
66
### Categories
64
67
65
68
When initialising the Logger, you can optionally provide categories to associate with each scope:
66
69
67
70
- DISABLED (will not print to console or save to log file)
68
-
- ENABLED (will print to console but not save to log file)
69
-
- MAXIMUM (will print to console and save to log file)
71
+
- PRINT (will print to console but not save to log file)
72
+
- SAVE (will to log file but not save print to console)
73
+
- MAXIMUM (will print to console and save to log file)
70
74
71
-
By default, the DEBUG scope is disabled, the INFO scope is enabled, and the ERROR, FATAL and WARNING scopes are all set to maximum. Scopes set to maximum are not *automatically* saved to the log file; calling `Logger.output()` will save them and then clean the in-memory log to avoid duplication.
75
+
By default, the DEBUG scope is disabled, the INFO scope is set to print, and the ERROR, FATAL and WARNING scopes are all set to maximum. Scopes set to save or maximum are not *automatically* saved to the log file; calling `Logger.output()` will save them and then clean the in-memory log to avoid duplication.
72
76
73
77
Categories are accessed like so:
74
78
@@ -104,10 +108,6 @@ Log.remove_scope("DEBUG")
104
108
105
109
It is recommended to be careful with this method. Removing scopes, like adding or editing them, is ephemeral and won't be hard-saved anywhere, but removing a scope during run-time will produce warnings if you attempt to use that scope anywhere in your program.
106
110
107
-
## Roadmap
108
-
109
-
- Rework `Logger.get()` to allow passing of a specific number of log values to be fetched. If these values exceed the number in the log, all matching log values should be returned, and a warning should be issued (but not returned).
110
-
111
-
- Possibly replace some internal warnings with Exceptions so they can be more easily-handled by end-user programs.
111
+
## Contributing
112
112
113
-
- Add a category that saves to the log file but doesn't print to the console.
113
+
I'm always happy to accept feature requests, bug reports, and any pull requests to improve the project. If you want to contribute, please explain clearly what your request or issue is so that I can provide solutions as swiftly as possible.
0 commit comments