Comments (4)
Since no well established/maintained logging framework or facade for Haxe exists, we are just using the trace
method to output some infos. If you want to suppress these messages you will need to override the trace method and discard them.
Something like this (untested):
final realTrace = haxe.Log.trace;
haxe.Log.trace = function(v:Dynamic, ?pos: haxe.PosInfos ):Void {
if (pos.className.indexOf("hx.concurrent") == -1) realTrace(v, pos);
}
from haxe-concurrent.
IMHO a library should not assume that printing to the standard output is safe: partly because diagnostic logs are just annoying who is not interested in and partly because a console environment may not be available (see this issue for example, where the error is indirectly caused by haxe-concurrent trying to call trace in the virtual console of Spyder IDE).
On the other hand tweaking haxe.Log just for a single library is a little awkward. Further if haxe-concurrent is not used by an application but by another library (as in my case), there isnโt a unique entry-point where one can redefine haxe.Log safely.
It would be better if haxe-concurrent wraps the calls to trace in a #if HX_CONCURRENT_LOG
block. So only the users who are interested can compile the library with the log enabled.
from haxe-concurrent.
You are mixing up usage of trace
vs Sys.stdout.write
. We are not printing directly to stdout, we use the trace function from the class haxe.Log
(which actually is for logging). Since the trace function receives all required context information via the pos
argument for you to decide which messages to filter out, the approach I laid out is perfectly valid. Rebinding the trace function is even described in the official Haxe docs https://api.haxe.org/haxe/Log.html
If you are not interested in any traces at all you can use the --no-traces
compiler option as described here https://haxe.org/manual/debugging-trace-log.html#removing-traces
from haxe-concurrent.
Iโm not entirely convinced that using trace as a log surrogate is good idea, but anyway the compiler flag --no-traces can be enough to resolve this specific issue.
Thanks for the hint.
from haxe-concurrent.
Related Issues (17)
- Right way to set the threads flag HOT 4
- Hashlink CG thread issue HOT 2
- Investigating Possible Memory Leak with Executor HOT 3
- How to ensure event is fired only Once! HOT 8
- haxe-concurrent doesn't work in android HOT 3
- Concurrent Map HOT 1
- "Virtual functions are pure" build error with RLock (HXCPP) HOT 4
- CPP abstract class error when building with Lime HOT 5
- Line ending issue in LICENSE.txt again HOT 1
- Thread Pool Spin Lock HOT 4
- [jvm] ExceptionInInitializerError HOT 9
- Specific code fails to port to HTML5, Flash HOT 3
- Error with latest Heapsio(hashlink target) and Haxe 4.0.0-rc2 HOT 1
- Package naming issue. HOT 2
- Example ? HOT 2
- Python 3.7 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haxe-concurrent.