User Manual

06.26.2025

MANUAL

Developer Funcion: Server Script: logs.Log

## Overview The Log method of the "[logs Object](/en/manual/server-script-logs)". It displays and outputs logs of the specified type in "[Server Script](/en/manual/table-management-server-script)". ## Syntax ``` logs.Log(type, message, method, console, syslogs) ``` ## Parameters |Parameters|Type|Required|Description| |:----------|:----------|:---:|:---------------------------| |type|int|Yes|Specifies the type of log. Possible values are as follows:<br>10:Info<br>50:Warning<br>60:UserError<br>80:SystemError<br>90:Exception| |message|string|Yes|Specifies the content of the error to display and output.| |method|string||Optional. Default value is an empty string.| |console|bool||Optional. Default value is true. Set to true to display in the browser developer tools console.| |syslogs|bool||Optional. Default value is true. Set to true to output to the system log.| ## Return Value Returns true if the log is successfully displayed and output, otherwise returns false. ## Display Format in Console ##### Display Format: ``` (SysLogType):[Method]Message ``` |Display column|Display content|Notes| |:----------|:-------|:-------| |Message|The string set in the message|| |Method|The string set in the method|Brackets ([]) are not displayed if the method is not specified.| |SysLogType|The string displayed based on the type:<br>10:Info<br>50:Warning<br>60:UserError<br>80:SystemError<br>90:Exception|| ## Output Column in System Log |Output destination column|Output content|Notes| |:----------|:-------|:-------| |Comments|The string set in the message|For types 10(Info)、50(Warning)、60(UserError)| |ErrMessage|The string set in the message|For types 80(SystemError)、90(Exception)| |Method|Combines the original method string with :method format.「:method」format|| |SysLogType|type|| ## Usage Example In the following example, a record with the title "About the Version Upgrade of Pleasanter" is created in a "temporary table" under Site ID 2. Based on the result, logs are output using logs.Log. ##### JavaScript ``` try { const siteId = 2; const item = items.NewIssue(); item.Title = 'About the Version Upgrade of Pleasanter'; const ret = items.Create(siteId, item); if (ret) { // Info log logs.Log(10, `Record created. Record ID:${item.IssueId}`); } else { // SystemError log logs.Log(80, `Failed to create the record. Site ID:${siteId}`); } } catch(e) { // Exception log logs.Log(90, `Exception occurred\n ${e.stack}`); } ``` ## Supported Versions |Supported Versions|Body| |:--|:--| |1.4.12.0 or later|Added function| ## Related Information <div id="ManualList"><ul><li><a href="/en/manual/table-management-server-script">Table Management: Server Script</a><span>08.13.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/server-script-logs">Developer Function: Server Script: logs</a><span>06.26.2025 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />
TOP
このページをシェアする
記載された商品名、各製品名は各社の登録商標または商標です。 © Implem Inc.