Skip to content
Merged
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
10 changes: 10 additions & 0 deletions bindings/javascript/emscripten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,14 @@ EMSCRIPTEN_BINDINGS(ggwave) {

return std::string();
}));

emscripten::function("disableLog", emscripten::optional_override(
[]() {
ggwave_setLogFile(NULL);
}));

emscripten::function("enableLog", emscripten::optional_override(
[]() {
ggwave_setLogFile(stderr);
}));
}
2 changes: 1 addition & 1 deletion bindings/javascript/ggwave.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions bindings/python/cggwave.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ cdef extern from "ggwave.h" nogil:
const char * dataBuffer,
int dataSize,
char * outputBuffer);

void ggwave_setLogFile(void * fptr);
7 changes: 7 additions & 0 deletions bindings/python/ggwave.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cimport cython

from libc.stdio cimport stderr
from cpython.mem cimport PyMem_Malloc, PyMem_Free

import re
Expand Down Expand Up @@ -62,3 +63,9 @@ def decode(instance, waveform):
return coutput[0:rxDataLength]

return None

def disableLog():
cggwave.ggwave_setLogFile(NULL);

def enableLog():
cggwave.ggwave_setLogFile(stderr);
3 changes: 3 additions & 0 deletions bindings/python/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

testFailed = False

ggwave.disableLog()
ggwave.enableLog()

samples = ggwave.encode("hello python")

if not (samples):
Expand Down
3 changes: 3 additions & 0 deletions tests/test-ggwave.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import sys
import ggwave

# optionally disable logging
#ggwave.disableLog()

# create ggwave instance with default parameters
instance = ggwave.init()

Expand Down