GithubHelp home page GithubHelp logo

Comments (10)

Richard-Cao avatar Richard-Cao commented on July 28, 2024 2

这块我们再考虑下吧

from logan.

Richard-Cao avatar Richard-Cao commented on July 28, 2024

主要是很多都在C层,没专门传递log,debug模式下的logcat是有一些

from logan.

lixi0912 avatar lixi0912 commented on July 28, 2024

可以考虑先在 JAVA 层增加,后续看是否需要迭代到 C 层

现在打了日志,但是只能导出日志才可以查看(或者打两份日志),开发调试时颇为不便

from logan.

Richard-Cao avatar Richard-Cao commented on July 28, 2024

你是说要看写入Logan的日志?

from logan.

lixi0912 avatar lixi0912 commented on July 28, 2024

是的,希望调试时,能在 logocat 直观看到明文的日志内容,在 Logan 设置 debug 模式时,发现只是输出一些 Logan 的操作日志,并非自己写入的内容。 如果要查看还需要将该日志导出或者其他途径去读取~ 总觉得在测试过程中并不是很便利(这个时候不禁想到 OkHttp 的 Interceptor ,增加拦截器后,在调试时的输出花样就多了)。

目前 Logan 加密和数据格式化都在 C 层,是否可以考虑通过拆包来解除耦合?这样就可以通过拦截器的概念来对数据定制化(加密、格式)

from logan.

Richard-Cao avatar Richard-Cao commented on July 28, 2024

明文看Logan日志内容,和Android自带的log没区别了呀,你在写入之前不就可以看到么。
Logan加密和数据格式化都在C层,是因为提升性能同时保证数据的隐私性,不被其他人破解,所以Java层只有预处理等操作,和日志真正的内容无关

from logan.

Richard-Cao avatar Richard-Cao commented on July 28, 2024

Logan不是用来代替Log打日志用的,而是用来存储关键日志,进行个案分析的

from logan.

lixi0912 avatar lixi0912 commented on July 28, 2024

通过拦截器对数据处理,实际操作一样可以放在 C 层,这并不影响拆包。

在调试过程中,关键日志同样需要在 Logocat 中可以查看,便于调试,于是就不得不多编写一份 Log 输出的代码。

    if (BuildConfig.DEBUG) {
         Log.e(xxx);
    }
    Logan.w(xxx);

虽然也可以通过包装一次 Logan 来处理这个问题

    public class LoganDelegate{
        public static void w(xxxx){
            if (BuildConfig.DEBUG) {
               Log.d(xxxx); 
           }
           Logan.w(xxxx);
        }
    }

不过这个 issue 主要目的并不是说输出 logocat 这个功能,而是建议拦截器的功能。这样可以给 Logan 带来更多的可能性,比如 数据格式( json、protobuf 或者其他),加密规则自定义(比如我想多加几次盐、或者把秘钥都写到 C 层、或者根据日志级别选择加密不加密、又或者想换其他的加密算法),数据范本自定义(可能并不满足于 WriteAction 的内容格式,也许我想更多的收集一些其他固定数据)

当有了拦截器后,除了实际写入的拦截器,其他的以分包的形式发布供于选择

    Logan.w -> DataEncapsulationInterceptor -> EncryptInterceptor -> WriteInterceptor

from logan.

Richard-Cao avatar Richard-Cao commented on July 28, 2024

我明白你的意思,不过在Logan中拦截器能做的确实有限,主要功能都在C,如果在java层只是定义拦截器配置传到C再去处理,就会徒增复杂度了。就比如你说要更改加密规则的前提是,C层要有实现才可以。

from logan.

lixi0912 avatar lixi0912 commented on July 28, 2024

如果不放弃性能就会提升复杂度,个人觉得这块性能的影响应该可以忽略?

from logan.

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.