Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions com/furusystems/slf4hx/bindings/SocketIOBinding.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.furusystems.slf4hx.bindings;
import com.furusystems.slf4hx.constants.Levels;
import haxe.Log;
import haxe.PosInfos;
import js.npm.socketio.Manager;

/**
* ...
* @author Miha Lunar
*/

class SocketIOBinding implements ILogBinding {

var manager:Manager;

public function new(manager) {
this.manager = manager;
}

public function print(owner:Dynamic, level:String, str:String) {
var id = Levels.getID(level);
var log = manager.log;
var s = str;
//var s = owner+" "+str;
if (id >= Levels.ERROR) {
log.error(s);
} else if (id == Levels.WARN) {
log.warn(s);
} else if (id == Levels.INFO) {
log.info(s);
} else {
log.debug(s);
}
}

}
27 changes: 27 additions & 0 deletions com/furusystems/slf4hx/bindings/StandardStreamBinding.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.furusystems.slf4hx.bindings;
import com.furusystems.slf4hx.constants.Levels;
import haxe.Log;
import haxe.PosInfos;

/**
* ...
* @author Miha Lunar
*/

class StandardStreamBinding implements ILogBinding
{

public function new() {}

/* INTERFACE slf4hx.bindings.ILogBinding */
private static var _lineNumber:Int = 0;
public function print(owner:Dynamic, level:String, str:String):Void
{
if (Levels.getID(level) >= Levels.ERROR) {
Sys.stderr().writeString(level+"\t"+str+"\n");
} else {
Sys.stdout().writeString(level+"\t"+str+"\n");
}
}

}