OPEN-SOURCE SCRIPT
Güncellendi

logger.DEMO

255
◼ Objective
This is an accompanying script to logger library. As the library has lot of logging features, this script demonstrates how all fields and methods interact to display logs on screen.


Please always use the latest version of the library and the key information functions


◼ How to access help and info about this library
Import the latest version of Library, call logger.overview(), and hover mouse over overview() to see help in Editor!

import GETpacman/logger/4 as logger

logger.overview() => Help and general information
logger.sampleCode() => Sample Code Usage
logger.fields() => For listing all fields
logger.methods() => For listing of all methods
Sürüm Notları
________________________________________________________________________________
DEMO v2: Test cases updated for next release of logger v4


◼ How to access help and info about this library
Import the Library, call logger.overview(), and hover mouse over overview() to see help in Editor!

import GETpacman/logger/4 as logger

logger.overview() => Help and general information
logger.sampleCode() => Sample Code Usage
logger.fields() => For listing all fields
logger.methods() => For listing of all methods


◼ Sample Console Code :
Console = A sleek single cell logging with a limit of 40960 characters. When you dont need a large logging capability.
Pine Script®
//@version=6 indicator("demo.Console", overlay=true) plot(na) import GETpacman/logger/4 as logger // Uncomment below line, then, hover mouse over console.log(), to see help info about this method //console.log() ip_showTable = input.bool (true, 'Show Console?  ',inline='Console1', group='Console') ip_position = input.string(position.bottom_right,'Position', inline='Console1', group='Console', options=[position.top_left, position.top_center, position.top_right, position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right]) ip_tsize = input.string(size.auto, 'Text Size', inline='Console1', group='Console', options=[size.auto,size.tiny,size.small,size.normal,size.large,size.huge]) ip_hsize = ip_tsize ip_thalign = text.align_left ip_tvalign = text.align_top var console = logger.log.new() console.init() // init() should be called as first line after variable declaration if barstate.isfirst console.markNewBar:=true console.pageOnEveryBar:=false console.showBarIndex:=false console.frameColor:=color.red // Lets log some sample messges console.log('Hello World') console.log('Hello World is in status', 'Hello World') console.log('Status persists if we dont pass status message or pass it as na') console.log('We can set a tooltip too', 'Hello World has a tooltip',na,true,'I am a tooltip in console message, hover over me','Hello World as tooltip of status') console.log('This message will be skipped', na, false) console.showBarIndex:=true console.log(logger.trace,'This is sample TRACE message') console.showDateTime:=true console.debug('This is a sample DEBUG message') console.log(2,'Message is split across Q1 to Q6', 3,' this is q2', 4,' this is q3', logger.error, 'this is q4') console.showLogLevels:=true console.info('above message did not appear completely as we logged to 4 different queues, and only 1st queue is displayed') console.showBarIndex:=false console.showDateTime:=false console.showLogLevels:=false console.fatal('This is sample FATAL message ') console.warning('this is sample WARNING message') console.log('') console.debug('There are lots of repeated messages in displayed in console, because on each bar, script is running and logging the messages.') console.debug('Setting pageOnEveryBar will clear the messages on each bar, which, for console is set to be false/off') // Settings can be changed anytime before show method is called., they take effect from the point they are called. console.frameColor:=color.blue // This wont throw error but is not used for console console.showHeader:=false // This should be the last line of your code, after all methods and settings have been dealt with. // No need to put inside barstate.islast condition, as its built in to do that, viz call itself on last bar only console.showLog(ip_position,ip_thalign, ip_tvalign, ip_tsize,ip_thalign, ip_tvalign, ip_tsize,show=ip_showTable)



◼ Sample Logx Code :
Logx = Multiple columns logging with a limit of 40960 characters each message. When you need to log large number of messages.
Pine Script®
//@version=6 indicator("demo.Logx", overlay=true) plot(na) import GETpacman/logger/4 as logger // Uncomment below line, then, hover mouse over logx.log(), to see help info about this method //logx.log() ip_showTable = input.bool (true, 'Show Logx?  ',inline='logx1', group='Logx') ip_position = input.string(position.bottom_right,'Position', inline='logx1', group='Logx', options=[position.top_left, position.top_center, position.top_right, position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right]) ip_tsize = input.string(size.auto, 'Text Size', inline='logx1', group='Logx', options=[size.auto,size.tiny,size.small,size.normal,size.large,size.huge]) ip_hsize = ip_tsize ip_thalign = text.align_left ip_tvalign = text.align_top var logx = logger.log.new() logx.init(isConsole=false) // init() should be called as first line after variable declaration if barstate.isfirst logx.markNewBar:=false logx.pageOnEveryBar:=true logx.showBarIndex:=false logx.showDateTime:=false logx.frameColor:=color.green logx.headerQ1:='Demo Q1' logx.headerQ2:='Demo Q2' logx.headerQ3:='Demo Q3' logx.showQ4:=true logx.headerQ4:='Demo q4' // Lets log some sample messges logx.log('Hello World') logx.log('Hello World is in status', 'Hello World') logx.log('Status persists if we dont pass status message or pass it as na') logx.log('We can set a tooltip too', 'Hello World has a tooltip',na, true,'I am a tooltip in logx message, hover over me','Hello World as tooltip of status') logx.log('This message will be skipped', na, false) logx.log(logger.trace,'This is a sample TRACE message') logx.debug('This is a sample DEBUG message') logx.log(2,'Different', 3,' colored', 4,' message', logger.error, 'across different queues', status='With Status set to this text') logx.showBarIndex:=true logx.showDateTime:=true logx.log(logger.trace, 2,'Different', 3,' colored', 4,' message', logger.error, 'across different queue, but BarIndex/DateTime different colored now ', status='With Status set to this text') logx.highlightText:=true logx.fatal('This is sample FATAL message with highlighting on') logx.warning('this is sample WARNING message with highlighting on') logx.highlightText:=false // Settings can be changed anytime before show method is called., they take effect from the point they are called. logx.frameColor:=color.olive // This should be the last line of your code, after all methods and settings have been dealt with. // No need to put inside barstate.islast condition, as its built in to do that, viz call itself on last bar only logx.showLog(ip_position,ip_thalign, ip_tvalign, ip_tsize,ip_thalign, ip_tvalign, ip_tsize,show=ip_showTable)

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.