Skip to content
kojix2 edited this page Jul 31, 2021 · 1 revision

The logger allows you to record native function calls in GR.rb.

require 'gr/plot'
require 'gr_commons/gr_logger'

GRCommons.gr_log('log.txt')

GR.plot([1, 2, 3], [3, 2, 5])
GR.updatews
  • cat log.txt | sed 's/\x1b\[[0-9;]*m//g'
  • cat log.txt | less -R
# Logfile created on 2021-07-31 16:52:29 +0900 by logger.rb/v1.4.3
I, [2021-07-31T16:52:29.123724 #81216]  INFO -- : GR::FFI.gr_clearws
[]

I, [2021-07-31T16:52:29.124301 #81216]  INFO -- : GR::FFI.gr_inqdspsize
[
    [0] #<GRCommons::Fiddley::MemoryPointer:0x000055e3a6d15c88 @size=8, @ptr=#<Fiddle::Pointer:0x000055e3a6e2c600 ptr=0x000055e3a6e2c5e0 size=8 free=0x0000000000000000>>,
    [1] #<GRCommons::Fiddley::MemoryPointer:0x000055e3a6d159b8 @size=8, @ptr=#<Fiddle::Pointer:0x000055e3a6c97d90 ptr=0x000055e3a6d03700 size=8 free=0x0000000000000000>>,
    [2] #<GRCommons::Fiddley::MemoryPointer:0x000055e3a6d15940 @size=4, @ptr=#<Fiddle::Pointer:0x000055e3a6a85bf0 ptr=0x000055e3a6d03720 size=4 free=0x0000000000000000>>,
    [3] #<GRCommons::Fiddley::MemoryPointer:0x000055e3a6d158c8 @size=4, @ptr=#<Fiddle::Pointer:0x000055e3a6d066d0 ptr=0x000055e3a6c97dd0 size=4 free=0x0000000000000000>>
]

I, [2021-07-31T16:52:29.124435 #81216]  INFO -- : GR::FFI.gr_setwsviewport
[
    [0] 0,
    [1] 0.165625,
    [2] 0,
    [3] 0.12421874999999999
]

I, [2021-07-31T16:52:29.124531 #81216]  INFO -- : GR::FFI.gr_setwswindow
[
    [0] 0,
    [1] 1,
    [2] 0,
    [3] 0.75
]

I, [2021-07-31T16:52:29.124623 #81216]  INFO -- : GR::FFI.gr_setviewport
[
    [0] 0.125,
    [1] 0.925,
    [2] 0.09375,
    [3] 0.6937500000000001
]

I, [2021-07-31T16:52:29.124726 #81216]  INFO -- : GR::FFI.gr_adjustlimits
[
    [0] #<GRCommons::Fiddley::MemoryPointer:0x000055e3a6b93fb8 @size=8, @ptr=#<Fiddle::Pointer:0x000055e3a6cc5170 ptr=0x000055e3a6ca64f0 size=8 free=0x0000000000000000>>,
    [1] #<GRCommons::Fiddley::MemoryPointer:0x000055e3a6b93ef0 @size=8, @ptr=#<Fiddle::Pointer:0x000055e3a6cc51d0 ptr=0x000055e3a6cc51b0 size=8 free=0x0000000000000000>>
]

I, [2021-07-31T16:52:29.124807 #81216]  INFO -- : GR::FFI.gr_tick
[
    [0] 1.0,
    [1] 3.0
]

I, [2021-07-31T16:52:29.124889 #81216]  INFO -- : GR::FFI.gr_adjustlimits
[
    [0] #<GRCommons::Fiddley::MemoryPointer:0x000055e3a6b889d8 @size=8, @ptr=#<Fiddle::Pointer:0x000055e3a6e6e1d0 ptr=0x000055e3a6ba0700 size=8 free=0x0000000000000000>>,
    [1] #<GRCommons::Fiddley::MemoryPointer:0x000055e3a6b88988 @size=8, @ptr=#<Fiddle::Pointer:0x000055e3a6e71350 ptr=0x000055e3a6e6e210 size=8 free=0x0000000000000000>>
]

I, [2021-07-31T16:52:29.124956 #81216]  INFO -- : GR::FFI.gr_tick
[
    [0] 2.0,
    [1] 5.0
]

I, [2021-07-31T16:52:29.125121 #81216]  INFO -- : GR::FFI.gr_setwindow
[
    [0] 1.0,
    [1] 3.0,
    [2] 2.0,
    [3] 5.0
]

I, [2021-07-31T16:52:29.125176 #81216]  INFO -- : GR::FFI.gr_setscale
[
    [0] 0
]

I, [2021-07-31T16:52:29.125227 #81216]  INFO -- : GR::FFI.gr_setlinecolorind
[
    [0] 1
]

I, [2021-07-31T16:52:29.125295 #81216]  INFO -- : GR::FFI.gr_setlinewidth
[
    [0] 1
]

I, [2021-07-31T16:52:29.125345 #81216]  INFO -- : GR::FFI.gr_setcharheight
[
    [0] 0.018
]

I, [2021-07-31T16:52:29.125511 #81216]  INFO -- : GR::FFI.gr_grid
[
    [0] 0.1,
    [1] 0.2,
    [2] 0,
    [3] 0,
    [4] 5,
    [5] 5
]

I, [2021-07-31T16:52:29.125642 #81216]  INFO -- : GR::FFI.gr_axes
[
    [0] 0.1,
    [1] 0.2,
    [2] 1.0,
    [3] 2.0,
    [4] 5,
    [5] 5,
    [6] 0.0075
]

I, [2021-07-31T16:52:29.125796 #81216]  INFO -- : GR::FFI.gr_axes
[
    [0] 0.1,
    [1] 0.2,
    [2] 3.0,
    [3] 5.0,
    [4] -5,
    [5] -5,
    [6] -0.0075
]

I, [2021-07-31T16:52:29.125855 #81216]  INFO -- : GR::FFI.gr_setcolormap
[
    [0] 44
]

I, [2021-07-31T16:52:29.125926 #81216]  INFO -- : GR::FFI.gr_uselinespec
[
    [0] " "
]

I, [2021-07-31T16:52:29.125958 #81216]  INFO -- : GR::FFI.gr_savestate
[]

I, [2021-07-31T16:52:29.126004 #81216]  INFO -- : GR::FFI.gr_uselinespec
[
    [0] ""
]

I, [2021-07-31T16:52:29.126092 #81216]  INFO -- : GR::FFI.gr_polyline
[
    [0] 3,
    [1] "\x00\x00\x00\x00\x00\x00\xF0?\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\b@",
    [2] "\x00\x00\x00\x00\x00\x00\b@\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x14@"
]

I, [2021-07-31T16:52:29.126124 #81216]  INFO -- : GR::FFI.gr_restorestate
[]

I, [2021-07-31T16:52:29.126151 #81216]  INFO -- : GR::FFI.gr_updatews
[]

I, [2021-07-31T16:52:29.126222 #81216]  INFO -- : GR::FFI.gr_updatews
[]