Logger: Abstract #21

Open
opened 2020-01-18 14:35:15 +01:00 by Kreyren · 1 comment
Kreyren commented 2020-01-18 14:35:15 +01:00 (Migrated from github.com)

We need a logger for actions of our package manager

ABSTRACT

Expecting 6 methods - info, warn, error, trace, fixme, unimplemented

All messages are expected to be customizable by the user/dev who is using our package manager

Logs should be store in file hierarchy defined log directory (on FSH3.0 that is /var/log/name)

  • On windows that is admin c:\programdata\name and user c:\users\user\appdata\local\name

Messages in CLI should be easy to understand by a dumb kid (for sake of example 6yo kid)

Messages in logs should be directed on developers

INFO

Message used to inform about something

  • Output INFO: message in stout of used console if quiet flag is NOT parsed
  • Output [timestamp INFO filename] message in logs

WARN

Message used to warn about something

  • Output WARN: message in stout of used console if quiet flag is NOT parsed
  • Output [timestamp WARN filename] message in logs

ERROR

Inform the user/dev about non-fatal errors during the runtime

  • Output ERROR: message in sterr of used console
  • Output [timestamp ERROR filename] message in logs

FIXME

Inform the user/dev about non-fatal error about unimplemented features that require contribution/fixing and for quality assurance checks

Example in shell (assuming that shell is widely understood):

# Original
fixme "Make sure that echo works cross-platform"
echo "something"

# First resolving of fixme
## NOTICE: Do not use `echo` that is not standardized cross-platform
printf '%s\n' "something"

# New fixme for a good feature (Used to direct workflow)
## NOTICE: Do not use `echo` that is not standardized cross-platform
fixme "Add translate for multiple languages"
printf '%s\n' "something"

# Resolving of fixme
## NOTICE: Do not use `echo` that is not standardized cross-platform
case $LANG in
  en*) printf '%s\n' "something" ;;
  cz*) printf '%s\n' "neco"
esac

  • Output FIXME: message by default that can be muted by the user/dev configuration
  • Output [timestamp FIXME filename] message in logs

TRACE

Verbose information about runtime of program used for diagnostics

  • Output TRACE: message if verbose flag is parsed by user/dev in cli
  • Output [timestamp TRACE filename] message in logs
  • It's expected to allow depth based on the amount of verbose flags parsed i.e if main -vvv is parsed -> Output all the information we can else if main -v is parsed output only essentials.
    • The depth of the messages should have different syntax so that it can be regexed out for diagnostics -- Maybe different message?
CONCEPT

# In logs one verbose flag
[timestamp TRACE filename] Opening something

# In logs two verbose flags
[timestamp TRACE filename] Opening something
  - Openned something using something
  - Other info

# In logs three verbose flags
[timestamp TRACE filename] Opening something
  - Openned somethinig located in somewhere using something located in somewhere using some library
  - Other info

UNIMPLEMENTED

Output fatal message informing about unimplemented feature (simmilar to FIXME but fatal)

  • Output UNIMPLEMENTED: message in sterr of used console
  • Outputs [timestamp UNIMPLEMENTED filename] message in logs
We need a logger for actions of our package manager ### ABSTRACT Expecting 6 methods - info, warn, error, trace, fixme, unimplemented All messages are expected to be customizable by the user/dev who is using our package manager Logs should be store in file hierarchy defined log directory (on FSH3.0 that is /var/log/name) - On windows that is `admin c:\programdata\name` and `user c:\users\user\appdata\local\name` Messages in CLI should be easy to understand by a dumb kid (for sake of example 6yo kid) Messages in logs should be directed on developers #### INFO Message used to inform about something - Output `INFO: message` in stout of used console if `quiet` flag is NOT parsed - Output `[timestamp INFO filename] message` in logs #### WARN Message used to warn about something - Output `WARN: message` in stout of used console if `quiet` flag is NOT parsed - Output `[timestamp WARN filename] message` in logs #### ERROR Inform the user/dev about non-fatal errors during the runtime - Output `ERROR: message` in sterr of used console - Output `[timestamp ERROR filename] message` in logs #### FIXME Inform the user/dev about non-fatal error about unimplemented features that require contribution/fixing and for quality assurance checks Example in shell (assuming that shell is widely understood): ```sh # Original fixme "Make sure that echo works cross-platform" echo "something" # First resolving of fixme ## NOTICE: Do not use `echo` that is not standardized cross-platform printf '%s\n' "something" # New fixme for a good feature (Used to direct workflow) ## NOTICE: Do not use `echo` that is not standardized cross-platform fixme "Add translate for multiple languages" printf '%s\n' "something" # Resolving of fixme ## NOTICE: Do not use `echo` that is not standardized cross-platform case $LANG in en*) printf '%s\n' "something" ;; cz*) printf '%s\n' "neco" esac ``` - Output `FIXME: message` by default that can be muted by the user/dev configuration - Output `[timestamp FIXME filename] message` in logs #### TRACE Verbose information about runtime of program used for diagnostics - Output `TRACE: message` if verbose flag is parsed by user/dev in cli - Output `[timestamp TRACE filename] message` in logs - It's expected to allow depth based on the amount of verbose flags parsed i.e if `main -vvv` is parsed -> Output all the information we can else if `main -v` is parsed output only essentials. - The depth of the messages should have different syntax so that it can be regexed out for diagnostics -- Maybe different message? ``` CONCEPT # In logs one verbose flag [timestamp TRACE filename] Opening something # In logs two verbose flags [timestamp TRACE filename] Opening something - Openned something using something - Other info # In logs three verbose flags [timestamp TRACE filename] Opening something - Openned somethinig located in somewhere using something located in somewhere using some library - Other info ``` #### UNIMPLEMENTED Output fatal message informing about unimplemented feature (simmilar to FIXME but fatal) - Output `UNIMPLEMENTED: message` in sterr of used console - Outputs `[timestamp UNIMPLEMENTED filename] message` in logs
github-actions[bot] commented 2020-05-11 02:02:20 +02:00 (Migrated from github.com)

Stale issue message

Stale issue message
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kreyren/Zernit#21