All Projects → sheypoor → log4k

sheypoor / log4k

Licence: Apache-2.0 license
https://proandroiddev.com/logging-in-kotlin-8ecfb97a4840

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to log4k

retext-assuming
Check for unhelpful ‘assuming’ phrases such as ‘just’, ‘simply’ or ‘obviously’ with retext
Stars: ✭ 15 (+25%)
Mutual labels:  assumptions
herald
Log annotation for logging frameworks
Stars: ✭ 71 (+491.67%)
Mutual labels:  log4j
python-log4rce
An All-In-One Pure Python PoC for CVE-2021-44228
Stars: ✭ 179 (+1391.67%)
Mutual labels:  log4j
minecraft-log4j-honeypot
Minecraft Honeypot for Log4j exploit. CVE-2021-44228 Log4Shell LogJam
Stars: ✭ 89 (+641.67%)
Mutual labels:  log4j
Student-Information-Administration-System
大学生信息管理系统——初学路上自己摸索实践的项目
Stars: ✭ 91 (+658.33%)
Mutual labels:  log4j
nmap-log4shell
Nmap Log4Shell NSE script for discovery Apache Log4j RCE (CVE-2021-44228)
Stars: ✭ 54 (+350%)
Mutual labels:  log4j
log4j-log4shell-affected
Lists of affected components and affected apps/vendors by CVE-2021-44228 (aka Log4shell or Log4j RCE). This list is meant as a resource for security responders to be able to find and address the vulnerability
Stars: ✭ 49 (+308.33%)
Mutual labels:  log4j
digital-copyright
Stamp your code with a trackable digital copyright
Stars: ✭ 17 (+41.67%)
Mutual labels:  log4j
hqc mp
微信小程序+微信管理后台+微信用户前台
Stars: ✭ 69 (+475%)
Mutual labels:  log4j
liquibase-slf4j
Liquibase SLF4J Logger.
Stars: ✭ 42 (+250%)
Mutual labels:  log4j
selenium BDD framework
Behavioural driven development UI automation framework using selenium, cucumber-java, testng, maven, phantomjs
Stars: ✭ 34 (+183.33%)
Mutual labels:  log4j
safelog4j
Safelog4j is an instrumentation-based security tool to help teams discover, verify, and solve log4shell vulnerabilities without scanning or upgrading
Stars: ✭ 38 (+216.67%)
Mutual labels:  log4j
owasp-security-logging
OWASP Security Logging library for Java
Stars: ✭ 106 (+783.33%)
Mutual labels:  log4j
fix4log4j
No description or website provided.
Stars: ✭ 21 (+75%)
Mutual labels:  log4j
Log4jPatcher
A mitigation for CVE-2021-44228 (log4shell) that works by patching the vulnerability at runtime. (Works with any vulnerable java software, tested with java 6 and newer)
Stars: ✭ 43 (+258.33%)
Mutual labels:  log4j
slf4j-timber
SLF4J binding for Jake Wharton's Timber Android logging library
Stars: ✭ 44 (+266.67%)
Mutual labels:  log4j
log4jpwn
log4j rce test environment and poc
Stars: ✭ 306 (+2450%)
Mutual labels:  log4j
MC-Log4J-Exploit-Checker
Checks Minecraft, MultiMC, Lunar and Badlion logs folder to see if you've been affected by the exploit!
Stars: ✭ 19 (+58.33%)
Mutual labels:  log4j
py4jshell
Simulating Log4j Remote Code Execution (RCE) vulnerability in a flask web server using python's logging library with custom formatter that simulates lookup substitution by executing remote exploit code.
Stars: ✭ 86 (+616.67%)
Mutual labels:  log4j
cloudrasp-log4j2
一个针对防御 log4j2 CVE-2021-44228 漏洞的 RASP 工具。 A Runtime Application Self-Protection module specifically designed for log4j2 RCE (CVE-2021-44228) defense.
Stars: ✭ 105 (+775%)
Mutual labels:  log4j

Build Status Download Download

Log4k

This is a simple library for logging in Kotlin. It's inspired by the famous Apache Log4j library.

Usage

After installation, you just need to call a one letter function like the following.

     d("This is my log")

For more advance logging experience you can describe the assumptions of a method with this library as follows.

   fun exampleMethod(foo: Boolean, bar: Boolean, ..., baz: Any?) {
       assumeTrue("Message of AssertionError when this assumption is not satisfied", foo)
           ?.assumeFalse("The same as the above message", bar)
           ...
           ?.assumeNotNull("An other message", baz) {
               // If all the above assumptions get satisfied then this block will be running.
               // Else an Assertion log will be triggered on the proper Appenders.
           }
           // Add more assumptions for the next block
           ?.assumeEquals("A message", foo, bar) {
               // This block will be running if all the above assumptions are true.
           }
   }

In this way, a new developer in your team easily will understand the assumptions of the writer of the method. Also, if each of the assumptions is not satisfied in the runtime, you can log the AssertionError to the Crashlytics or other services for another review of the method in the future.

Installation

Download it in gradle for your Android app like this

implementation "com.log4k:log4k:${log4kVersion}"
implementation "com.log4k:log4k-android:${log4kVersion}"

For the recent version, check out the Bintray badges on top of this README file.

Then in the onCreate method of your Application class setup it like this

if (BuildConfig.DEBUG) {
    Log4k.add(Level.Verbose, ".*", AndroidAppender())
    Log4k.add(Level.Verbose, "com\\.log4k\\.sample\\..+", DefaultAppender())
    Log4k.add(Level.Verbose, ".*", DefaultAppender(writer = PrintWriter(File(externalCacheDir, "debug-log.txt"))))
} else {
    Log4k.add(Level.Assert, "com\\.log4k\\.sample\\..+", DefaultAppender(writer = PrintWriter(File(filesDir, "log.txt"))))
}

As you can see, you can any kind of appender to handle different kinds of logs. For instance, the AndroidAppender appender log as an ordinary Android Log. Or the DefaultAppender(writer = PrintWriter(File(externalCacheDir, "debug-log.txt"))) appender log into a file in external cache directory.

Contribution

Just create your branch from master branch, change it, write additional tests, satisfy all tests, create your pull request, thank you, you're awesome.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].