A simple, lightweight logging library for Kotlin.
- 🚀 Simple API - Just call
info(),warn(), orerror() - 📦 Lightweight - Zero dependencies (only Kotlin stdlib)
- 🎯 Easy to use - No configuration needed
- 🔧 Pure Kotlin - Written in 100% Kotlin
Add the dependency to your build.gradle.kts:
dependencies {
implementation("com.dryfish09:quicklog:1.0.0")
}dependencies {
implementation 'com.dryfish09:quicklog:1.0.0'
}<dependency>
<groupId>com.dryfish09</groupId>
<artifactId>quicklog</artifactId>
<version>1.0.0</version>
</dependency>import com.dryfish09.quicklog.*
fun main() {
info("Application started successfully")
warn("Disk space is running low")
error("Failed to connect to database")
}Output:
[INFO]: Application started successfully
[WARN]: Disk space is running low
[ERROR]: Failed to connect to database
import com.dryfish09.quicklog.*
class UserService {
fun createUser(username: String, email: String) {
info("Creating user: $username")
if (username.isBlank()) {
warn("Username is empty for email: $email")
return
}
try {
// Save user to database
saveToDatabase(username, email)
info("User created successfully: $username")
} catch (e: Exception) {
error("Failed to create user $username: ${e.message}")
}
}
private fun saveToDatabase(username: String, email: String) {
// Database logic here
}
}import com.dryfish09.quicklog.*
import java.io.File
class FileProcessor {
fun processFile(filePath: String) {
info("Processing file: $filePath")
val file = File(filePath)
if (!file.exists()) {
error("File not found: $filePath")
return
}
if (!file.canRead()) {
warn("File exists but cannot be read: $filePath")
return
}
try {
val content = file.readText()
info("Successfully read ${content.length} characters")
// Process content...
} catch (e: Exception) {
error("Error processing file: ${e.message}")
}
}
}import com.dryfish09.quicklog.*
class ApiClient(private val baseUrl: String) {
fun fetchUser(userId: String): String? {
info("Fetching user with ID: $userId")
return try {
val response = makeApiCall("$baseUrl/users/$userId")
info("Successfully fetched user: $userId")
response
} catch (e: Exception) {
error("API call failed for user $userId: ${e.message}")
null
}
}
private fun makeApiCall(url: String): String {
// Actual API call logic here
return "{\"id\": \"123\", \"name\": \"John\"}"
}
}| Function | Description | Output Format |
|---|---|---|
info(msg: String) |
Log an informational message | [INFO]: message |
warn(msg: String) |
Log a warning message | [WARN]: message |
error(msg: String) |
Log an error message | [ERROR]: message |
- JDK 11 or higher
- Gradle 8.5+ (or use the provided wrapper)
# Clone the repository
git clone https://github.com/dryfish09/quicklog.git
cd quicklog
# Build the library
./gradlew build
# Run tests
./gradlew test
# Generate JAR file
./gradlew jar
# Publish to Maven Local
./gradlew publishToMavenLocal# Run all tests
./gradlew test
# Run specific test class
./gradlew test --tests "com.dryfish09.quicklog.QuickLogTest"
# Run tests with detailed output
./gradlew test --infoThe library includes comprehensive unit tests covering:
- Normal message logging
- Empty messages
- Special characters and Unicode
- Long messages
- Concurrent logging
- Performance (30,000+ logs under 1 second)
quicklog/
├── src/
│ ├── main/
│ │ └── kotlin/com/dryfish09/quicklog/
│ │ └── QuickLog.kt # Main library code
│ └── test/
│ └── kotlin/com/dryfish09/quicklog/
│ ├── QuickLogTest.kt # Unit tests
│ └── QuickLogIntegrationTest.kt
├── build.gradle.kts # Gradle build file
├── settings.gradle.kts # Gradle settings
├── gradle.properties # Gradle configuration
├── README.md # This file
└── LICENSE # License file
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Kotlin coding conventions
- Add unit tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting PR
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Copyright 2024 dryfish09
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
dryfish09
- GitHub: @dryfish09
- 📧 Email: realmg51@gmail.com
- 🐛 Issues: GitHub Issues
- Initial release
- Added
info(),warn(),error()functions - Added comprehensive unit tests
- Added Gradle build configuration
- Add log levels (DEBUG, INFO, WARN, ERROR, FATAL)
- Support custom output destinations (files, network, etc.)
- Add log formatting options
- Support structured logging (JSON)
- Add async logging support
- Create Android version
- Simple: No complex configuration, just import and use
- Fast: Minimal overhead, perfect for logging
- Kotlin-first: Designed specifically for Kotlin projects
- Production-ready: Thoroughly tested and stable
Made with ❤️ by dryfish09