Skip to content

Commit 121e28e

Browse files
committed
updated doc on swig generated libs. added Go example
1 parent 1306568 commit 121e28e

File tree

1 file changed

+27
-10
lines changed

1 file changed

+27
-10
lines changed

doc/README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,26 +216,43 @@ The InfoLogger library allows to inject messages directly from programs, as show
216216
217217
Usually, one will only take care of defining the per-message messageOptions struct and a context with appropriate Facility field set, all other being set automatically.
218218
219-
* InfoLogger library is also available for: Tcl, Python.
219+
* InfoLogger library is also available for: Tcl, Python, Go.
220220
It allows to log message from scripting languages. A simplified subset of the InfoLogger C++ API is made available through SWIG-generated modules.
221-
Example usage is shown below, launching interactive interpreters from the command line.
221+
Example usage is shown below. Files listed there are available from the infoLogger library installation directory.
222222
223-
* Python example:
223+
* Tcl
224+
** Library files: infoLoggerForTcl.so
225+
** Code example: (interactive interpreter from the command line)
226+
```
227+
tclsh
228+
load infoLoggerForTcl.so
229+
set logHandle [InfoLogger]
230+
$logHandle logInfo "This is a test"
231+
$logHandle logError "Something went wrong"
232+
```
233+
* Python
234+
** Library files: _infoLoggerForPython.so and infoLoggerForPython.py
235+
** Code example: (interactive interpreter from the command line)
224236
```
225237
python
226238
import infoLoggerForPython
227239
logHandle=infoLoggerForPython.InfoLogger()
228240
logHandle.logInfo("This is a test")
229241
logHandle.logError("Something went wrong")
230242
```
231-
* Tcl example:
243+
* Go
244+
** Library files: infoLoggerForGo.a and infoLoggerForGo.go (to be copied to ${GOPATH}/src/infoLoggerForGo)
245+
** Build: CGO_LDFLAGS="${GOPATH}/src/infoLoggerForGo/infoLoggerForGo.a -lstdc++" go build
246+
** Code example:
247+
```
248+
package main
249+
import "infoLoggerForGo"
250+
func main() {
251+
var logHandle=infoLoggerForGo.NewInfoLogger()
252+
logHandle.LogInfo("This is a test")
253+
logHandle.LogError("Something went wrong")
254+
}
232255
```
233-
tclsh
234-
load infoLoggerForTcl.so
235-
set logHandle [InfoLogger]
236-
$logHandle logInfo "This is a test"
237-
$logHandle logError "Something went wrong"
238-
```
239256
240257
241258
## Configuration

0 commit comments

Comments
 (0)