GithubHelp home page GithubHelp logo

Comments (6)

igelgrun avatar igelgrun commented on August 27, 2024

Hello,

Unfortunately, android-logger library doesn't support dynamic tag changing.

I suggest you using my fork of LOGBack library: https://github.com/noveogroup/logback-android
You can download it here: https://github.com/noveogroup/android-logger/blob/gh-downloads/logback-android-1.0.10-3-SNAPSHOT-android-logger.jar?raw=true
For more information look at the beggining of description of android-logger: https://github.com/noveogroup/android-logger/blob/master/README.md

LOGBack has a lot of useful settings including configurable tags you need. My fork of this library contains simple adapter ch.qos.logback.classic.android.Log that can be used as standard Android logger but without tag parameter - it will get the tag from the configuration as you described.

The configuration you need is (place it in manifest file):

<logback>
    <configuration>
      <appender
          name="LOGCAT"
          class="ch.qos.logback.classic.android.LogcatAppender" >
          <tagEncoder>
              <pattern>%logger{0}</pattern>
          </tagEncoder>
          <encoder>
              <pattern>%msg%n</pattern>
          </encoder>
      </appender>

      <root level="WARN" >
          <appender-ref ref="LOGCAT" />
      </root>
    </configuration>
</logback>

I hope it helps you :)

from android-logger.

jromero avatar jromero commented on August 27, 2024

I would rather not add a large library for something as simple as logging with a configuration file. This was the original reason why I choose to use android-logger vs many others. I've built the functionality, see [https://github.com/jromero/android-logger/commit/c5cca70c8626acfa6945d0fb73bc466d3bf456a4]. I've also updated the sample branch [https://github.com/jromero/android-logger/commit/da316b6f5313978b95ecfe9bff6a58f8c8c85a32].

I think it would be beneficial to continue development of this particular library vs moving on to logback. I can make a pull request if you wish to continue maintaining it or otherwise I can rebrand and maintain it myself.

from android-logger.

igelgrun avatar igelgrun commented on August 27, 2024

I'm developing new version of android-logger with tag & message formatting support but last months I was in "vacation".

May I publish a link to your fork until I do new version ?

from android-logger.

igelgrun avatar igelgrun commented on August 27, 2024

By the way, thank you for the interest. It inspires :)

from android-logger.

jromero avatar jromero commented on August 27, 2024

You can definitely link to my fork. Also, if I may suggest renaming the library to something more unique only so that it can more easily be searched for or suggested in conversation. If you search for android logger it's not really among the top answers but the built in android Log/Logger class. Keep up the good work. Can't wait for later releases.

from android-logger.

igelgrun avatar igelgrun commented on August 27, 2024

The new release 1.3.0 is done :)

from android-logger.

Related Issues (20)

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.