print์™€ NSLog๋Š” ์–ด๋–ค ์ฐจ์ด์ ์ด ์žˆ์„๊นŒ?

Log๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•˜๋Š” ์ด์œ ๋Š” Why we should use Log๋ฅผ ์ฐธ๊ณ ํ•˜์ž.

์˜ˆ์‹œ

let array = [1, 2, 3, 4, 5]
print(array)
NSLog(array.description)
[1, 2, 3, 4, 5]
2017-05-31 13:14:38.582 ProjetName[2286:7473287] [1, 2, 3, 4, 5]

print vs. NSLog

printNSLog
- String ์ œ์™ธ ํƒ€์ž…๋„ ์ถœ๋ ฅ ๊ฐ€๋Šฅ
- Device console์—์„œ๋งŒ ์ถœ๋ ฅ๋จ
- NSLog๋ณด๋‹ค ๋น ๋ฆ„
- Single Thread.
- String ํƒ€์ž…๋งŒ ์ถœ๋ ฅ ๊ฐ€๋Šฅ
- Time Stamp์™€ Project ์ด๋ฆ„์ด ๊ฐ™์ด ์ถœ๋ ฅ๋จ
- Device, Debugger Console ๋ชจ๋‘์—์„œ ์ถœ๋ ฅ๋จ
- print๋ณด๋‹ค ๋Š๋ฆผ
- Multi Thread ์ง€์›, Thread Safe

๋” ์•Œ์•„๋ณด๊ธฐ

  • ์ด์ œ๋Š” WWDC 2020์— ๋‚˜์˜จ Logger๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค.
  • ์ด๋Š” ์ถ”ํ›„ ์ •๋ฆฌํ•ด๋ณผ ์˜ˆ์ •

Reference