Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Logging Utility with Colors #43

Open
kashifkhan0771 opened this issue Nov 19, 2024 · 3 comments · May be fixed by #85
Open

[FEATURE] Logging Utility with Colors #43

kashifkhan0771 opened this issue Nov 19, 2024 · 3 comments · May be fixed by #85
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@kashifkhan0771
Copy link
Owner

Feature Description

A new logging utility that supports color-coded log levels with the types INFO, DEBUG, WARN, and ERROR. Each log type will be associated with a specific color to improve visibility and help distinguish between the log types in the terminal. Additionally, we will introduce formatting methods that allow for customization of log messages, providing users with flexibility in how logs are displayed.

Color-Coding:

  • INFO: Blue
  • DEBUG: Green
  • WARN: Yellow
  • ERROR: Red

Use Case

  • Development Debugging
  • Monitoring
  • Testing

Proposed Solution

Define ANSI Escape Codes for Colors:
The color codes follow the ANSI escape sequence format.
For example:

  • \033[34m for blue
  • \033[32m for green
  • \033[33m for yellow
  • \033[31m for red

To reset colors back to default, you can use \033[0m.

Logger Structure:
Implement a basic logger with log levels and formatting.

Custom Formatter:
A method that applies colors to logs based on their level.


Additional Context

N/A


Pseudo Code

logger := NewLogger()  // Create new logger instance
logger.SetLevel(INFO)  // Set minimum log level to INFO
logger.Info("This is an info message")
logger.Debug("This is a debug message")
logger.Warn("This is a warning message")
logger.Error("This is an error message")

// output should be like following:
[2024-11-19 15:04:05] [INFO] MyApp: This is an informational message.
@kashifkhan0771 kashifkhan0771 added enhancement New feature or request help wanted Extra attention is needed labels Nov 19, 2024
@kashifkhan0771 kashifkhan0771 changed the title [FEATURE] Logging Utility with Colors and Log Redaction [FEATURE] Logging Utility with Colors Nov 19, 2024
@shahzadhaider1
Copy link
Collaborator

I'd like to pick this, if no one else is working on it

@Turtel216
Copy link
Contributor

I'd like to pick this, if no one else is working on it

Are you still planning on doing this or is it open to pick up by somebody else ?

(There is nobody assigned to this issue)

@kashifkhan0771
Copy link
Owner Author

@shahzadhaider1 are you working on this? You are assigned to couple of other issues as well, if you do not have much bandwidth, can you assign this to @Turtel216?

@Turtel216 Turtel216 linked a pull request Jan 9, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants