Giter Club home page Giter Club logo

tonystone / tracelog Goto Github PK

View Code? Open in Web Editor NEW
52.0 52.0 15.0 2.48 MB

TraceLog is a highly configurable, flexible, portable, and simple to use debug logging system for Swift and Objective-C applications running on Linux, macOS, iOS, watchOS, and tvOS.

Home Page: https://tonystone.io/tracelog

License: Apache License 2.0

Ruby 0.53% Objective-C 2.20% Swift 96.10% CMake 1.17%
cocoapods debug ios linux log-statements logging logging-library macos osx swift swift-3 swift-package-manager swift3 swiftpm trace trace-level tracelog tvos watchos

tracelog's People

Contributors

appsandwich avatar climatert avatar jflamm avatar phchang avatar tonystone avatar tonystone-j2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

tracelog's Issues

On the topic of including (or not, and how) the OSLoggers for a common API

Okay. So I've asked in the forums about how to tackle the issue that @tonystone presented at #44 here:

I chose to keep it separate for one primary reason which is that I don't want to force all Linux users to have to install systemd-dev just to use TraceLog. There are many applications that do not have a need for that Writer and just want to link to TraceLog and go.

I think that you're right, Tony. But I feel like it's better to have it be included by default. If you agree, the method provided in the forums opens up a (mostly) clear way.

But here's my justification for wanting it be included by default: in a server environment, where you'd be more restrictive on what packages you install, you'd (almost certainly) want to put your log entries in the system journal so that's alright.

That leaves us with the desktop users, both in Mac and Linux, and the users in mobile Darwin (iOS, WatchOS) platforms.

Let's first tackle where the Darwin (both desktop and mobile) users lie right now. As it stands, the 4.0.0 release gives them os_log logging. If an app or library developer chooses to use it, no problem! And if they don't... good as well! The current TraceLog code wouldn't change at all.

That leaves us with the Linux desktop users. If you were in Windows, you'd be reticent to install anything and with good reason. But in Linux, specially if you're using apt-get (Debian) or another trusted, signed repository, you know it doesn't contain malicious software, and can verify the integrity of the binaries. The two main concerns would then be (a) Breaking another package or (b) Binary size. In the case of Python packages, (a) is completely justified because setting it up correctly requires a bit of black magic. In this case, with libsystemd-dev being a OS-provided library, that should never happen.

(b) Is the last concern. I went and looked up how much systemd-dev weighs, and it's less than 1 MB!, which is actually less than I expected ๐Ÿ˜….

So all in all, I think it makes sense for it to be included by default.


Now from an API standpoint, I think we should either:

  • Include OS logging in both (Darwin, Linux) platforms by default.
  • Not include OS logging in both platforms, by default, and include it with a compile-time option (e.g by reading an environment variable at the Package manifest).

This would make the API uniform in all platforms, which brings a lot of benefits. Take for example a library author who wants to use TraceLog in the current configuration for OS logging, who might be testing it only on MacOS first. Then when they try to port it to Linux, they find themselves having to use a bunch of #if os(...), #elseif statements because the TraceLog API they were using is not available under Linux.

If instead the API was uniform, when they started porting it to Linux they would install systemd-dev and after that everything would behave in exactly the same way as it does on MacOS. And that, I think, would be a great relief ๐Ÿ˜Œ


I will write up on ideas of how to implement this afterwards because my hands are very tired at the moment ๐Ÿ˜…

Please, lemme know what you think ๐Ÿ™‚

Question about system logs

Hi Tony and others (if there are) ^^

I'm helping at the langserver-swift project and we'd like to have some cross-platform logging. And since I know for a fact that TraceLog does work on both Darwin and Linux, I'm thinking it might be the perfect tool for the job.

Yesterday when we were talking about this, Ryan said that we should be outputting the log messages to Unified logging on Darwin and to the systemd logging journal on Linux. I think that's reasonable. Is is possible to configure TraceLog to do that? I know close to nothing about system logs so please forgive me if I'm noobing too much here. I know I probably am ๐Ÿ˜…

[API question] Printing logs to `stdout`

Hi again :)

Not wanting to clutter up #44 unnecessarily, I've opened this issue.

I'm learning the basics of TraceLog by writing a Swift script. So far, it compiles, but I can't seem to be able to print the logs to stdout and I don't really know why. Here's what I have so far. I must be missing a config step or something?

Thanks :)

Enhance `FileWriter` on iOS to only write when protected data is available.

Describe the solution you'd like
Add checks specifically for iOS that monitor the protected state of the log file currently being written to and only write when it is available. this would use the new FailureReason to return .unavailable when the protected data is not available.

Describe alternatives you've considered
None.

Consider to reinstate the OFF log level

In the current version of TraceLog, the lowest log level is ERROR.

I'm running a use case where I'm interested the log output of only a single tag, regardless of any errors in other tags.

This would only be possible by setting LOG_ALL=OFF, which is no longer an option. I would like to request the ability to do so, which will then allow me to use LOG_PREFIX_TagIAmInterestedIn = INFO, to only see all the INFO and below logs, and only for the tag I am interested in.

Add archive and/or delete to `FileWriter` rotate strategy.

Describe the solution you'd like
In order to control and limit space taken on disk for files written with the FileWriter, we should have a way to control the number and disposition of files created. these can take the form of an Archive (compress) and/or delete after a certain number of a file or a certain size of space taken is reached.

Describe alternatives you've considered
None considered accept for doing nothing which is not an option for files that grow to large sizes due to verbose logging or simply time written to a single log file.

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.