Closed felix91gr closed 6 years ago
@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.
Yes, I'll upload it to github. Gimme a couple of minutes :)
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 :+1:
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.
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
So as I expected it was the async nature of TraceLog
It was indeed! now it works flawlessly :')
Btw, maybe rename it to tracelog-usage
It is done :)
I should write something before closing the issue:
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 :)
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 :)