Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit fa181c2

Browse files
committed
New Log function
1 parent 3acdda2 commit fa181c2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lua/autorun/!!!sh_plib.lua

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,19 @@ end
104104
-- Log
105105
do
106106

107+
local lightGrey, darkWhite = GetColor( 'light_grey' ), GetColor( 'dark_white' )
108+
local sideColor = GetColor( SERVER and 'server' or 'client' )
107109
local string_NetFormat = string.NetFormat
108-
local isstring = isstring
109110
local os_time = os.time
110111
local os_date = os.date
111112

112-
function Log( level, color, str, ... )
113-
ArgAssert( level, 1, 'string' )
114-
ArgAssert( str, 2, 'string' )
115-
MsgC( GetColor( 'light_grey' ), os_date( '[%H:%M:%S]', os_time() ), GetColor( isstring( color ) and color or (SERVER and 'blue' or 'orange') ), '[' .. (SERVER and 'SERVER' or 'CLIENT') .. '/' .. level .. ']: ', GetColor( 'dark_white' ), string_NetFormat( str, ... ) .. '\n' )
113+
function Log( levelColor, level, nameColor, name, str, ... )
114+
ArgAssert( levelColor, 1, 'table' ); ArgAssert( level, 2, 'string' ); ArgAssert( nameColor, 3, 'table' ); ArgAssert( name, 4, 'string' )
115+
MsgC( lightGrey, os_date( '%d/%m/%Y %H:%M:%S ', os_time() ), levelColor, level, lightGrey, ' --- ', sideColor, '[' .. (SERVER and 'SERVER' or 'CLIENT') .. '] ', nameColor, name, lightGrey, ' : ', darkWhite, string_NetFormat( str, ... ), '\n' )
116+
end
117+
118+
end
119+
116120
end
117121

118122
end

0 commit comments

Comments
 (0)