Giter Site home page Giter Site logo

kflogger's Introduction

Hi there ๐Ÿ‘‹, I am Giancarlo.

Check out my portfolio here

Work

Google Summer of Code

  • โ˜€๏ธ Google Summer of Code 2023 @ Kotlin Foundation
  • ๐Ÿชต Worked on KFlogger, the Kotlin Multiplatform version of Google's logging tool Flogger. Read about it here.
  • ๐Ÿ“š Read about my proposal here

sentry.io

Education

  • ๐ŸŽ“ Vienna University of Technology BSc

Email

kflogger's People

Contributors

buenaflor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

kflogger's Issues

FluentLogger.java migration to Kotlin JVM leads to exception when used in Kotlin

Migrating FluentLogger.java to Kotlin JVM is simple and straightforward, however using FluentLogger.forEnclosingClass() in Kotlin modules leads to Exception in thread "main" java.lang.IllegalStateException: no caller found on the stack for: com.buenaflor.kflogger.FluentLogger where as in Java modules it works as intended.

However, the unmodified Java version: FluentLogger.java works in both Kotlin and Java modules.

The cause of this would be this function inside forEnclosingClass():

Platform.getCallerFinder().findLoggingClass(FluentLogger::class.java)

After investigation, it would use this function to retrieve the logging class: https://github.com/google/flogger/blob/13e8ba1a08641c8e0561e0eda6edb2bf5b658d8c/api/src/main/java/com/google/common/flogger/util/JavaLangAccessStackGetter.java#L34C28-L34C36

Additional Info

Kotlin version:

@JvmStatic
public actual fun forEnclosingClass(): FluentLogger {
    val loggingClass = Platform.getCallerFinder().findLoggingClass(
        FluentLogger::class.java
    )
    return FluentLogger(Platform.getBackend(loggingClass))
}

Java version:

  public static FluentLogger forEnclosingClass() {
    String loggingClass = Platform.getCallerFinder().findLoggingClass(FluentLogger.class);
    return new FluentLogger(Platform.getBackend(loggingClass));
  }

Add common tests to make sure that JVM doesn't crash

Currently only the original JVM Flogger tests are run but it doesn't test if the common code compiles and doesn't crash.

Especially since we have to suppress a lot of the typealiases, we have to make sure that nothing crashes unexpectedly.

Flogger Kotlin JVM migrations tracker

List of Flogger files that are available in commonMain:

  • LogData
  • LoggerBackend
  • Metadata
  • AbstractLogger
  • FluentLogger
  • LoggingApi
  • LoggingScope (missing expects)
  • LoggingScopeProvider
  • LogPerBucketingStrategy
  • LogSite
  • LogSiteKey
  • MetadataKey (missing expects)
  • StackSize
  • LogContext
  • MessageParser
  • PrintfMessageParser and DefaultPrintfMessageParser
  • Parameter
  • AbstractBackend
  • BackendFactory
  • Platform

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.