Giter Club home page Giter Club logo

Comments (8)

tonystone avatar tonystone commented on May 30, 2024 1

Btw, maybe rename it to tracelog-usage so it matches other modules and repos that I may create for it. Also may be easier to find it looking for tracelog specifically

from tracelog.

felix91gr avatar felix91gr commented on May 30, 2024 1

So as I expected it was the async nature of TraceLog

It was indeed! now it works flawlessly :')

from tracelog.

tonystone avatar tonystone commented on May 30, 2024

@felix91gr, do you have a project file you can point me to? Trying to figure out how this is executed and packaged. Btw, I don't see anything obvious from the gist.

Remember that currently TraceLog is asynchronous so there is a possibility that the message did not have a chance to print before the script finished.

from tracelog.

felix91gr avatar felix91gr commented on May 30, 2024

Yes, I'll upload it to github. Gimme a couple of minutes :)

from tracelog.

felix91gr avatar felix91gr commented on May 30, 2024

Here it is

Sorry for the name, but I was thinking of offering it to you as a TraceLog showcase project after I figured out how to use it :) The idea would be to show the most common use cases of the library.

If you want me to, I can change the name np 👍

from tracelog.

tonystone avatar tonystone commented on May 30, 2024

So as I expected it was the async nature of TraceLog. Try this (and I know it is not the right solution but it will show the issue with a script):

import Foundation
import TraceLog

TraceLog.configure(writers: [ConsoleWriter()], environment: ["LOG_ALL": "TRACE4"])

print("Hello!")

for _ in 0..<100 {
	logError { "Hey, I'm logging stuff! :D" }
}

print("Goodbye!")

sleep(20)

So it would be very easy to add a sync mode for script usage.

from tracelog.

felix91gr avatar felix91gr commented on May 30, 2024

Btw, maybe rename it to tracelog-usage

It is done :)

from tracelog.

felix91gr avatar felix91gr commented on May 30, 2024

I should write something before closing the issue:

  • Issue was resolved by using Foundation.sleep. The problem was that the call was asyncronous and I didn't realize. I was waiting for logs to happen before the program went on. Apart from that, the API was used allright :)

from tracelog.

Related Issues (8)

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.